Serializer is the base class for all binary message interpreters. More...
#include <Serializer.h>

Public Member Functions | |
| virtual uint32_t | CalculateSerializedLength (const swarmio::data::Variant &value, const FieldStack &fieldStack) const =0 |
| Calculate the length of a serialized message in bytes. More... | |
| virtual swarmio::data::Variant | Deserialize (ros::serialization::IStream &stream, const FieldStack &fieldStack) const =0 |
| Deserialize a stream into a variant. More... | |
| virtual swarmio::data::Variant | DeserializeArray (ros::serialization::IStream &stream, uint32_t count, const FieldStack &fieldStack) const =0 |
| Deserialize a stream into a variant array. More... | |
| virtual void | EmitDefault (ros::serialization::OStream &stream, const FieldStack &fieldStack) const =0 |
| Write the default value to the stream. More... | |
| virtual uint32_t | GetDefaultLength (const FieldStack &fieldStack) const =0 |
| Get the length of the default value. More... | |
| virtual swarmio::data::discovery::Field | GetFieldDescriptor () const =0 |
| Build a field descriptor for the underlying type. More... | |
| virtual const std::string & | GetFullName () const |
| Get the fully qualified name for the type behind the serializer. More... | |
| const std::string & | GetName () const |
| Get the non-qualified name for the type behind the serializer. More... | |
| virtual void | Serialize (ros::serialization::OStream &stream, const swarmio::data::Variant &value, const FieldStack &fieldStack) const =0 |
| Serialize a variant onto a stream. More... | |
| virtual | ~Serializer () |
| Destructor. More... | |
Protected Member Functions | |
| Serializer (const std::string &name) | |
| Construct a new Serializer object. More... | |
Static Protected Member Functions | |
| static const Serializer & | SerializerForType (const std::string &type, const std::string &parentPackage) |
| Look up or build a reader for a message type. More... | |
Static Private Member Functions | |
| static std::map< std::string, std::unique_ptr< Serializer > > | LoadDefaultSerializers () |
| Load the list of default serializers. More... | |
Private Attributes | |
| std::string | _name |
| Non-qualified name for the type behind the serializer. More... | |
Static Private Attributes | |
| static std::map< std::string, std::unique_ptr< Serializer > > | _defaultSerializers = Serializer::LoadDefaultSerializers() |
| List of built-in default serializers. More... | |
Serializer is the base class for all binary message interpreters.
Definition at line 17 of file Serializer.h.
|
inlineprotected |
Construct a new Serializer object.
Definition at line 46 of file Serializer.h.
|
inlinevirtual |
Destructor.
Definition at line 146 of file Serializer.h.
|
pure virtual |
Calculate the length of a serialized message in bytes.
| value | Value |
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.
|
pure virtual |
Deserialize a stream into a variant.
| stream | Input stream |
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, and swarmros::introspection::ArrayField.
|
pure virtual |
Deserialize a stream into a variant array.
| stream | Input stream |
| count | Item count |
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::PrimitiveSerializer, and swarmros::introspection::Field.
|
pure virtual |
Write the default value to the stream.
| stream | Output stream |
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.
|
pure virtual |
Get the length of the default value.
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.
|
pure virtual |
Build a field descriptor for the underlying type.
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, swarmros::introspection::ArrayField, and swarmros::introspection::FixedArrayField.
|
inlinevirtual |
Get the fully qualified name for the type behind the serializer.
Reimplemented in swarmros::introspection::MessageSerializer.
Definition at line 77 of file Serializer.h.
|
inline |
Get the non-qualified name for the type behind the serializer.
Definition at line 66 of file Serializer.h.
|
staticprivate |
Load the list of default serializers.
Definition at line 13 of file Serializer.cpp.
|
pure virtual |
Serialize a variant onto a stream.
| stream | Output stream |
| value | Value to serialize |
| fieldStack | Stack of fields to determine location |
Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, and swarmros::introspection::ArrayField.
|
staticprotected |
Look up or build a reader for a message type.
| type | Message type |
| parentPackage | Package where the type was referenced |
Definition at line 40 of file Serializer.cpp.
|
staticprivate |
List of built-in default serializers.
Definition at line 25 of file Serializer.h.
|
private |
Non-qualified name for the type behind the serializer.
Definition at line 38 of file Serializer.h.