@@ -131,4 +131,74 @@ class ShapeShifter : public ::topic_tools::ShapeShifter
131131
132132}
133133
134+ #if !ROS_VERSION_MINIMUM(1, 15, 0)
135+ namespace ros {
136+ namespace message_traits {
137+
138+ template <> struct IsMessage <cras::ShapeShifter> : TrueType { };
139+ template <> struct IsMessage <const cras::ShapeShifter> : TrueType { };
140+
141+ template <>
142+ struct MD5Sum <cras::ShapeShifter>
143+ {
144+ static const char * value (const cras::ShapeShifter& m) { return m.getMD5Sum ().c_str (); }
145+ static const char * value () { return " *" ; }
146+ };
147+
148+ template <>
149+ struct DataType <cras::ShapeShifter>
150+ {
151+ static const char * value (const cras::ShapeShifter& m) { return m.getDataType ().c_str (); }
152+ static const char * value () { return " *" ; }
153+ };
154+
155+ template <>
156+ struct Definition <cras::ShapeShifter>
157+ {
158+ static const char * value (const cras::ShapeShifter& m) { return m.getMessageDefinition ().c_str (); }
159+ };
160+
161+ }
162+
163+ namespace serialization
164+ {
165+
166+ template <>
167+ struct Serializer <cras::ShapeShifter>
168+ {
169+ template <typename Stream>
170+ inline static void write (Stream& stream, const cras::ShapeShifter& m) {
171+ m.write (stream);
172+ }
173+
174+ template <typename Stream>
175+ inline static void read (Stream& stream, cras::ShapeShifter& m)
176+ {
177+ m.read (stream);
178+ }
179+
180+ inline static uint32_t serializedLength (const cras::ShapeShifter& m) {
181+ return m.size ();
182+ }
183+ };
184+
185+
186+ template <>
187+ struct PreDeserialize <cras::ShapeShifter>
188+ {
189+ static void notify (const PreDeserializeParams<cras::ShapeShifter>& params)
190+ {
191+ std::string md5 = (*params.connection_header )[" md5sum" ];
192+ std::string datatype = (*params.connection_header )[" type" ];
193+ std::string msg_def = (*params.connection_header )[" message_definition" ];
194+ std::string latching = (*params.connection_header )[" latching" ];
195+
196+ params.message ->morph (md5, datatype, msg_def, latching);
197+ }
198+ };
199+
200+ }
201+ }
202+ #endif
203+
134204#include " impl/shape_shifter.hpp"
0 commit comments