shared_ptr<KeyValue> WordFrequencyFeeder::next() { KeyValueField key; KeyValueField value; try{ const TWReader::T_PageRecord* record = m_reader->nextRecord(); if(record){ key.appendStr(record->url); value.appendStr(record->body); KeyValue* nextKeyValue = new KeyValue(1); nextKeyValue->setKey(key); nextKeyValue->setValue(0,value); shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); return pNextKeyValue; } }catch (TWReaderException &E) { cout << E.what() << endl; } catch (exception &E) { cout << E.what() << endl; } //return a nul object, it sucks. // key.appendStr(""); // value.appendStr(""); // KeyValue* nextKeyValue = new KeyValue(1); // nextKeyValue->setKey(key); // nextKeyValue->setValue(0,value); // shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); KeyValue* nextKeyValue = NULL; shared_ptr<KeyValue> pNextKeyValue(nextKeyValue); return pNextKeyValue; }