void RobotConfiguration::deserialize(ObjectData& data, IdContext& /*context*/) {
    /*Serializable::deserialize(data,context);*/
    _name = data.getString("name");
    _baseReferenceFrameId = data.getString("baseReferenceFrameId");
    ArrayData& frameArray=data.getField("frames")->getArray();
    for (size_t i =0; i< frameArray.size(); i++){
      ValueData& v = frameArray[i];
      Identifiable* id = v.getPointer();
      ReferenceFrame* f = dynamic_cast<ReferenceFrame*>(id);
      if (f){
	addReferenceFrame(f);
      }
    }
    ArrayData& sensorArray=data.getField("sensors")->getArray();
    for (size_t i =0; i< sensorArray.size(); i++){
      ValueData& v = sensorArray[i];
      Identifiable* id = v.getPointer();
      BaseSensor* s = dynamic_cast<BaseSensor*>(id);
      if (s){
	cerr << "Adding Sensor: " << id->className() << endl;
	addSensor(s);
      }
    }
    isReadyUpdate();
  }
示例#2
0
  void ImageData::deserialize(ObjectData& data, IdContext& context){
    //cerr << "A";
    BaseSensorData::deserialize(data,context);
    // alternative 1, creating an own field
    //cerr << "B";
    ObjectData * blobData = static_cast<ObjectData *>(data.getField("imageBlob"));
    _imageBlob.deserialize(*blobData,context);
    // alterative 2 embedding
    //_imageBlob.deserialize(data,context);
 }