7 #include <std_msgs/Header.h> 46 : _serializer(nullptr), _type(
"*") { }
89 _serializer =
nullptr;
147 struct MD5Sum<swarmros::introspection::Message>
159 if (serializer !=
nullptr)
161 return serializer->
GetHash().c_str();
165 throw Exception(
"Trying to serialize Message without serializer");
197 if (serializer !=
nullptr)
199 return message.
GetType().c_str();
203 throw Exception(
"Trying to serialize Message without serializer");
235 if (serializer !=
nullptr)
241 throw Exception(
"Trying to serialize Message without serializer");
268 if (serializer !=
nullptr)
270 if (serializer->HasHeader())
281 throw Exception(
"Trying to serialize VariantMessage without serializer");
291 template<
typename Stream>
295 if (serializer !=
nullptr)
297 if (serializer->HasHeader())
304 throw Exception(
"Trying to serialize VariantMessage without serializer");
314 template<
typename Stream>
318 if (serializer !=
nullptr)
320 if (serializer->HasHeader())
327 throw Exception(
"Trying to deserialize VariantMessage without serializer");
const std_msgs::Header & GetHeader() const
Get a reference to the header.
const std::string & GetCanonicalDefinition() const
Get the canonical definition of the message.
const MessageSerializer * GetSerializer() const
Get the associated serializer.
static const char * value(const swarmros::introspection::Message &message)
Uses the message serializer to retreive the full name of the underlying data type.
const std::string & GetHash() const
Get the MD5 hash of the message definition file.
static const char * value()
Returns a wildcard MD5 hash to accept all messages.
static const char * value()
Returns a wildcard data type to accept all messages.
static const MessageSerializer & MessageSerializerForType(const std::string &type, const std::string &parentPackage)
Look up or build a reader for a message type.
Message(const std::string &type)
Build an Message instance for a specific type.
Serializer for full-fledged message types.
Message is the base class for message types supported by the introspection library.
static const char * value(const swarmros::introspection::Message &message)
Uses the message serializer to retreive the canonical definition of the underlying data type...
static void read(Stream &stream, swarmros::introspection::Message &message)
Reads the header from the stream, if present.
void SetType(const std::string &type)
Set the type of the object and fetch its serializer.
std::string _type
ROS type.
std_msgs::Header & GetMutableHeader()
Get a mutable reference to the header.
static void write(Stream &stream, const swarmros::introspection::Message &message)
Writes the header to the stream, if present.
std_msgs::Header _header
Header.
static uint32_t serializedLength(const swarmros::introspection::Message &message)
Calculates the size of the header, if present.
const std::string & GetType() const
Get the fully qualified type of the message.
static const char * value(const swarmros::introspection::Message &message)
Uses the message serializer to retreive the MD5 hash of the message definition.
Message()
Construct an empty Message instance.
void EraseType()
Erase type information from message.
const MessageSerializer * _serializer
Reference to the serializer used to construct this message.
virtual const std::string & GetFullName() const override
Get the fully qualified name for the type behind the serializer.