Changeset 55:1b9f78c39c47 in finroc_plugins_parameters


Ignore:
Timestamp:
08.06.2017 02:43:58 (20 months ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
17.03
Phase:
public
Message:

Fixes serialization of static parameters

Location:
internal
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • internal/tStaticParameterImplementationBase.cpp

    r53 r55  
    144144  // Skip name and parameter type 
    145145  is.ReadString(); 
    146   is.ReadShort(); 
     146  rrlib::rtti::tType dt; 
     147  is >> dt; 
    147148 
    148149  std::string command_line_option_tmp = is.ReadString(); 
     
    215216#endif 
    216217 
    217 void tStaticParameterImplementationBase::DeserializeValue(rrlib::serialization::tInputStream& is) 
    218 { 
    219   if (is.ReadBoolean()) 
    220   { 
    221     rrlib::rtti::tType dt = rrlib::rtti::tType::GetType(is.ReadShort()); 
    222     rrlib::rtti::tGenericObject* val = ValuePointer(); 
    223     if (val->GetType() != dt) 
    224     { 
    225       CreateBuffer(dt); 
    226       val = ValuePointer(); 
    227     } 
    228     val->Deserialize(is, rrlib::serialization::tDataEncoding::XML); 
     218void tStaticParameterImplementationBase::DeserializeValue(rrlib::serialization::tInputStream& stream) 
     219{ 
     220  if (stream.ReadBoolean()) 
     221  { 
     222    rrlib::rtti::tType type; 
     223    stream >> type; 
     224    rrlib::rtti::tGenericObject* value = ValuePointer(); 
     225    if (value->GetType() != type) 
     226    { 
     227      throw std::runtime_error("Objects of different type than parameter type are not supported"); 
     228    } 
     229    value->Deserialize(stream, rrlib::serialization::tDataEncoding::XML); 
    229230    NotifyChange(); 
    230231  } 
  • internal/tStaticParameterImplementationBase.h

    r40 r55  
    112112   * Deserializes value from stream 
    113113   * 
    114    * \param is Input stream 
    115    */ 
    116   void DeserializeValue(rrlib::serialization::tInputStream& is); 
     114   * \param stream Input stream 
     115   */ 
     116  void DeserializeValue(rrlib::serialization::tInputStream& stream); 
    117117 
    118118  /*! 
Note: See TracChangeset for help on using the changeset viewer.