38 #ifndef PI_PROPERTIES_NICEHEADER_SERIALIZER 39 #define PI_PROPERTIES_NICEHEADER_SERIALIZER 41 #include <rtt/Property.hpp> 42 #include <rtt/marsh/StreamProcessor.hpp> 43 #include <rtt/marsh/MarshallInterface.hpp> 54 template<
typename o_stream>
56 :
public marsh::MarshallInterface,
public marsh::StreamProcessor<o_stream>
62 typedef o_stream output_stream;
63 typedef o_stream OutputStream;
66 marsh::StreamProcessor<o_stream>(os),
67 did_comment(
false), nameless_counter(0)
73 virtual void serialize(base::PropertyBase* v)
75 Property<PropertyBag>* bag =
dynamic_cast< Property<PropertyBag>*
>( v );
77 this->serialize( *bag );
79 store( v->getName() );
83 virtual void serialize(
const PropertyBag &v)
86 if (did_comment ==
false )
91 PropertyBag::const_iterator i = v.getProperties().begin();
92 i != v.getProperties().end();
107 nameless_counter = 0;
108 if ( !prefix.empty() )
109 *this->s <<
' ' << prefix <<
'.';
112 if ( nameless_counter )
113 *this->s << nameless_counter;
118 virtual void serialize(
const Property<PropertyBag> &v)
120 if ( v.rvalue().empty() )
121 store( v.getName() +
"[0]" );
123 std::string oldpref = prefix;
124 if ( prefix.empty() )
125 prefix = v.getName();
127 prefix +=
'.' + v.getName();
129 serialize(v.rvalue());
132 nameless_counter = 0;
139 nameless_counter = 0;
140 *this->s << std::endl;