void PVStructure::serialize(ByteBuffer *pbuffer, SerializableControl *pflusher, BitSet *pbitSet) const { PVStructure* nonConstThis = const_cast<PVStructure*>(this); size_t numberFields = nonConstThis->getNumberFields(); size_t offset = nonConstThis->getFieldOffset(); int32 next = pbitSet->nextSetBit(offset); // no more changes or no changes in this structure if(next<0||next>=static_cast<int32>(offset+numberFields)) return; // entire structure if(static_cast<int32>(offset)==next) { serialize(pbuffer, pflusher); return; } size_t fieldsSize = pvFields.size(); for(size_t i = 0; i<fieldsSize; i++) { PVFieldPtr pvField = pvFields[i]; offset = pvField->getFieldOffset(); int32 inumberFields = pvField->getNumberFields(); next = pbitSet->nextSetBit(offset); // no more changes if(next<0) return; // no change in this pvField if(next>=static_cast<int32>(offset+inumberFields)) continue; // serialize field or fields if(inumberFields==1) { pvField->serialize(pbuffer, pflusher); } else { PVStructurePtr pvStructure = std::tr1::static_pointer_cast<PVStructure>(pvField); pvStructure->serialize(pbuffer, pflusher, pbitSet); } } }