29 std::list<std::unique_ptr<Field>>
_fields;
108 MessageSerializer(
const std::string& package,
const std::string& name,
const std::string& path);
MessageSerializer(const std::string &package, const std::string &name, const std::string &path)
Construct a new MessageSerializer object.
virtual swarmio::data::Variant DeserializeArray(ros::serialization::IStream &stream, uint32_t count, const FieldStack &fieldStack) const override
Deserialize a stream into a variant array.
bool HasHeader() const
Checks whether the message fits the requirements of a message with a header.
std::string _hash
MD5 hash of the message.
const std::string & GetCanonicalDefinition() const
Get the canonical definition of the message.
void EnumerateFields(std::function< bool(unsigned, const Field &)> enumerator) const
Enumerate the fields of the message with a function.
const std::string & GetHash() const
Get the MD5 hash of the message definition file.
static const MessageSerializer & MessageSerializerForType(const std::string &type, const std::string &parentPackage)
Look up or build a reader for a message type.
const Field * _shortcut
For certain messages, the normal field processing is skipped and a single field is used to deserializ...
static std::map< std::string, std::unique_ptr< MessageSerializer > > _messageSerializers
Map of message serializers.
const std::string & GetPackage() const
Get package name.
Serializer for full-fledged message types.
A Field represents an entry in a message reader that can read one of its fields.
bool _hasHeader
Whether the message begins with the standard header.
std::list< ConstantField > _constants
Constant fields.
virtual swarmio::data::Variant Deserialize(ros::serialization::IStream &stream, const FieldStack &fieldStack) const override
Deserialize a stream into a variant.
std::list< std::unique_ptr< Field > > _fields
Variable fields.
virtual void Serialize(ros::serialization::OStream &stream, const swarmio::data::Variant &value, const FieldStack &fieldStack) const override
Serialize a variant onto a stream.
virtual uint32_t GetDefaultLength(const FieldStack &fieldStack) const override
Get the length of the default value.
std::string _package
Package name.
virtual void EmitDefault(ros::serialization::OStream &stream, const FieldStack &fieldStack) const override
Write the default value to the stream.
Serializer is the base class for all binary message interpreters.
std::string CalculateHash()
Calculate the MD5 hash used to identify the message type.
std::string BuildCanonicalDefinition()
Build a canonical definition for the message.
virtual swarmio::data::discovery::Field GetFieldDescriptor() const override
Build a field descriptor for the underlying type.
virtual const std::string & GetFullName() const override
Get the fully qualified name for the type behind the serializer.
virtual uint32_t CalculateSerializedLength(const swarmio::data::Variant &value, const FieldStack &fieldStack) const override
Calculate the length of a serialized message in bytes.
std::string _canonicalDefinition
Canonical definition of the message.
swarmio::data::discovery::Schema GetSchemaDescriptor(unsigned skipCount) const
Build a field descriptor for the underlying type, with or without its header.
std::string _fullName
Full name.