void URLTable::serialize( StreamBuffer &stream ) { for ( std::map<int, string>::iterator it = map.begin(); it!=map.end(); ++it){ stream.write(&it->first); int tmp = it->second.length(); stream.write(&tmp); stream.write(it->second.c_str(), it->second.length()); } }
void WordMap::serialize( StreamBuffer &stream ) { for ( std::map<string, int>::iterator it = map.begin(); it!=map.end(); ++it) { int tmp = it->first.length(); stream.write(&tmp); stream.write(it->first.c_str(), it->first.length()); stream.write(&it->second); } }