void Encoder::encodeSegmentBody( DataDestination & destination, Codecs::PresenceMap & pmap, const Codecs::SegmentBodyCPtr & segment, const Messages::MessageAccessor & accessor) { size_t instructionCount = segment->size(); for( size_t nField = 0; nField < instructionCount; ++nField) { PROFILE_POINT("encode field"); Codecs::FieldInstructionCPtr instruction; if(segment->getInstruction(nField, instruction)) { destination.startField(*(instruction->getIdentity())); instruction->encode(destination, pmap, *this, accessor); destination.endField(*(instruction->getIdentity())); } } }
void Decoder::decodeSegmentBody( DataSource & source, Codecs::PresenceMap & pmap, const Codecs::SegmentBodyCPtr & segment, Messages::ValueMessageBuilder & messageBuilder) { size_t instructionCount = segment->size(); for( size_t nField = 0; nField < instructionCount; ++nField) { PROFILE_POINT("decode field"); const Codecs::FieldInstructionCPtr & instruction = segment->getInstruction(nField); if(verboseOut_) { (*verboseOut_) <<std::endl << "Decode instruction[" <<nField << "]: " << instruction->getIdentity()->name() << std::endl; } source.beginField(instruction->getIdentity()->name()); (void)instruction->decode(source, pmap, *this, messageBuilder); } }