void ImageData::serialize(ObjectData& data, IdContext& context) { BaseSensorData::serialize(data,context); // alternative 1, creating an own field ObjectData * blobData=new ObjectData(); data.setField("imageBlob", blobData); _imageBlob.serialize(*blobData,context); }
void RobotConfiguration::serialize(ObjectData& data, IdContext& /*context*/) { /*Serializable::serialize(data,context);*/ data.setString("name", _name); data.setString("baseReferenceFrameId", _baseReferenceFrameId); ArrayData* frameArray = new ArrayData; for (std::map<std::string, ReferenceFrame*>::iterator it = _frameMap.begin(); it!=_frameMap.end(); it++){ ReferenceFrame* frame=it->second; frameArray->add(new PointerData(frame)); cerr << "adding frame:" << it->second->name() << endl; } data.setField("frames", frameArray); ArrayData* sensorArray = new ArrayData; for (std::map<std::string, BaseSensor*>::iterator it = _sensorMap.begin(); it!=_sensorMap.end(); it++){ BaseSensor* sensor=it->second; sensorArray->add(new PointerData(sensor)); cerr << "adding sensor:" << it->second->topic() << endl; } data.setField("sensors", sensorArray); }