diff --git a/pvDataApp/factory/PVStructure.cpp b/pvDataApp/factory/PVStructure.cpp index 7090997..62b2af5 100644 --- a/pvDataApp/factory/PVStructure.cpp +++ b/pvDataApp/factory/PVStructure.cpp @@ -52,14 +52,14 @@ PVStructure::PVStructure(StructureConstPtr const & structurePtr) size_t numberFields = structurePtr->getNumberFields(); FieldConstPtrArray fields = structurePtr->getFields(); StringArray fieldNames = structurePtr->getFieldNames(); - PVFieldPtrArray * xxx = const_cast(&pvFields); - xxx->reserve(numberFields); +// PVFieldPtrArray * xxx = const_cast(&pvFields); + pvFields.reserve(numberFields); PVDataCreatePtr pvDataCreate = getPVDataCreate(); for(size_t i=0; ipush_back(pvDataCreate->createPVField(fields[i])); + pvFields.push_back(pvDataCreate->createPVField(fields[i])); } for(size_t i=0; isetParentAndName(this,fieldNames[i]); + pvFields[i]->setParentAndName(this,fieldNames[i]); } } @@ -560,21 +560,24 @@ bool PVStructure::putExtendsStructureName( void PVStructure::serialize(ByteBuffer *pbuffer, SerializableControl *pflusher) const { - for(size_t i = 0; iserialize(pbuffer, pflusher); } void PVStructure::deserialize(ByteBuffer *pbuffer, DeserializableControl *pcontrol) { - for(size_t i = 0; ideserialize(pbuffer, pcontrol); } void PVStructure::serialize(ByteBuffer *pbuffer, SerializableControl *pflusher, BitSet *pbitSet) const { - size_t numberFields = const_cast(this)->getNumberFields(); - size_t offset = const_cast(this)->getFieldOffset(); + PVStructure* nonConstThis = const_cast(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 @@ -586,8 +589,9 @@ void PVStructure::serialize(ByteBuffer *pbuffer, return; } - for(size_t i = 0; igetFieldOffset(); int32 inumberFields = pvField->getNumberFields(); next = pbitSet->nextSetBit(offset); @@ -611,29 +615,30 @@ void PVStructure::deserialize(ByteBuffer *pbuffer, DeserializableControl *pcontrol, BitSet *pbitSet) { size_t offset = getFieldOffset(); size_t numberFields = getNumberFields(); - size_t next = pbitSet->nextSetBit(offset); + int32 next = pbitSet->nextSetBit(offset); // no more changes or no changes in this structure - if(next<0||next>=offset+numberFields) return; + if(next<0||next>=static_cast(offset+numberFields)) return; // entire structure - if(offset==next) { + if(static_cast(offset)==next) { deserialize(pbuffer, pcontrol); return; } - for(size_t i = 0; igetFieldOffset(); - numberFields = pvField->getNumberFields(); + int32 inumberFields = pvField->getNumberFields(); next = pbitSet->nextSetBit(offset); // no more changes if(next<0) return; // no change in this pvField - if(next>=offset+numberFields) continue; + if(next>=static_cast(offset+inumberFields)) continue; // deserialize field or fields - if(numberFields==1) { + if(inumberFields==1) { pvField->deserialize(pbuffer, pcontrol); } else { PVStructurePtr pvStructure = std::tr1::static_pointer_cast(pvField); diff --git a/pvDataApp/pv/pvData.h b/pvDataApp/pv/pvData.h index 507f2df..d30617b 100644 --- a/pvDataApp/pv/pvData.h +++ b/pvDataApp/pv/pvData.h @@ -814,7 +814,7 @@ public: */ PVStructure(StructureConstPtr const & structure,PVFieldPtrArray const & pvFields); private: - const PVFieldPtrArray pvFields; + PVFieldPtrArray pvFields; StructureConstPtr structurePtr; String extendsStructureName; friend class PVDataCreate;