Public Member Functions | Protected Member Functions | Static Protected Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
swarmros::introspection::Serializer Class Referenceabstract

Serializer is the base class for all binary message interpreters. More...

#include <Serializer.h>

Inheritance diagram for swarmros::introspection::Serializer:
Inheritance graph
[legend]

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 SerializerSerializerForType (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...
 

Detailed Description

Serializer is the base class for all binary message interpreters.

Definition at line 17 of file Serializer.h.

Constructor & Destructor Documentation

swarmros::introspection::Serializer::Serializer ( const std::string &  name)
inlineprotected

Construct a new Serializer object.

Definition at line 46 of file Serializer.h.

virtual swarmros::introspection::Serializer::~Serializer ( )
inlinevirtual

Destructor.

Definition at line 146 of file Serializer.h.

Member Function Documentation

virtual uint32_t swarmros::introspection::Serializer::CalculateSerializedLength ( const swarmio::data::Variant &  value,
const FieldStack fieldStack 
) const
pure virtual

Calculate the length of a serialized message in bytes.

Parameters
valueValue
fieldStackStack of fields to determine location
Returns
uint32_t

Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.

virtual swarmio::data::Variant swarmros::introspection::Serializer::Deserialize ( ros::serialization::IStream stream,
const FieldStack fieldStack 
) const
pure virtual

Deserialize a stream into a variant.

Parameters
streamInput stream
fieldStackStack of fields to determine location
Returns
swarmio::data::Variant

Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, and swarmros::introspection::ArrayField.

virtual swarmio::data::Variant swarmros::introspection::Serializer::DeserializeArray ( ros::serialization::IStream stream,
uint32_t  count,
const FieldStack fieldStack 
) const
pure virtual

Deserialize a stream into a variant array.

Parameters
streamInput stream
countItem count
fieldStackStack of fields to determine location
Returns
swarmio::data::Variant

Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::PrimitiveSerializer, and swarmros::introspection::Field.

virtual void swarmros::introspection::Serializer::EmitDefault ( ros::serialization::OStream stream,
const FieldStack fieldStack 
) const
pure virtual
virtual uint32_t swarmros::introspection::Serializer::GetDefaultLength ( const FieldStack fieldStack) const
pure virtual
virtual swarmio::data::discovery::Field swarmros::introspection::Serializer::GetFieldDescriptor ( ) const
pure virtual
virtual const std::string& swarmros::introspection::Serializer::GetFullName ( ) const
inlinevirtual

Get the fully qualified name for the type behind the serializer.

Returns
const std::string&

Reimplemented in swarmros::introspection::MessageSerializer.

Definition at line 77 of file Serializer.h.

const std::string& swarmros::introspection::Serializer::GetName ( ) const
inline

Get the non-qualified name for the type behind the serializer.

Returns
const std::string&

Definition at line 66 of file Serializer.h.

std::map< std::string, std::unique_ptr< Serializer > > Serializer::LoadDefaultSerializers ( )
staticprivate

Load the list of default serializers.

Returns
std::map<std::string, std::unique_ptr<Serializer>>

Definition at line 13 of file Serializer.cpp.

virtual void swarmros::introspection::Serializer::Serialize ( ros::serialization::OStream stream,
const swarmio::data::Variant &  value,
const FieldStack fieldStack 
) const
pure virtual

Serialize a variant onto a stream.

Parameters
streamOutput stream
valueValue to serialize
fieldStackStack of fields to determine location

Implemented in swarmros::introspection::MessageSerializer, swarmros::introspection::ConstantField, swarmros::introspection::PrimitiveSerializer, swarmros::introspection::Field, and swarmros::introspection::ArrayField.

const Serializer & Serializer::SerializerForType ( const std::string &  type,
const std::string &  parentPackage 
)
staticprotected

Look up or build a reader for a message type.

Parameters
typeMessage type
parentPackagePackage where the type was referenced
Returns
const Serializer&

Definition at line 40 of file Serializer.cpp.

Member Data Documentation

std::map< std::string, std::unique_ptr< Serializer > > Serializer::_defaultSerializers = Serializer::LoadDefaultSerializers()
staticprivate

List of built-in default serializers.

Definition at line 25 of file Serializer.h.

std::string swarmros::introspection::Serializer::_name
private

Non-qualified name for the type behind the serializer.

Definition at line 38 of file Serializer.h.


The documentation for this class was generated from the following files:


swarmros
Author(s):
autogenerated on Fri Apr 3 2020 03:42:48