Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
swarmros::introspection::Field Class Reference

A Field represents an entry in a message reader that can read one of its fields. More...

#include <Field.h>

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

Public Member Functions

virtual uint32_t CalculateSerializedLength (const swarmio::data::Variant &value, const FieldStack &fieldStack) const override
 Calculate the length of a serialized message in bytes. More...
 
virtual swarmio::data::Variant Deserialize (ros::serialization::IStream &stream, const FieldStack &fieldStack) const override
 Deserialize a stream into a variant. More...
 
virtual swarmio::data::Variant DeserializeArray (ros::serialization::IStream &stream, uint32_t count, const FieldStack &fieldStack) const override
 Deserialize a stream into a variant array - not supported on Fields. More...
 
virtual void EmitDefault (ros::serialization::OStream &stream, const FieldStack &fieldStack) const override
 Write the default value to the stream. More...
 
 Field (const std::string &name, const Serializer &serializer)
 Construct a new Field object. More...
 
virtual uint32_t GetDefaultLength (const FieldStack &fieldStack) const override
 Get the length of the default value. More...
 
virtual swarmio::data::discovery::Field GetFieldDescriptor () const override
 Build a field descriptor for the underlying type. More...
 
const SerializerGetSerializer () const
 Get the associated serializer. More...
 
virtual void Serialize (ros::serialization::OStream &stream, const swarmio::data::Variant &value, const FieldStack &fieldStack) const override
 Serialize a variant onto a stream. More...
 
virtual void WriteDefinition (std::stringstream &stream, bool forHash) const
 Write the definition of this field to a string stream. More...
 
- Public Member Functions inherited from swarmros::introspection::Serializer
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 ~Serializer ()
 Destructor. More...
 

Protected Member Functions

void WriteTypeName (std::stringstream &stream, bool forHash) const
 Get the type name for the serializer. More...
 
- Protected Member Functions inherited from swarmros::introspection::Serializer
 Serializer (const std::string &name)
 Construct a new Serializer object. More...
 

Protected Attributes

const Serializer_serializer
 Serializer. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from swarmros::introspection::Serializer
static const SerializerSerializerForType (const std::string &type, const std::string &parentPackage)
 Look up or build a reader for a message type. More...
 

Detailed Description

A Field represents an entry in a message reader that can read one of its fields.

Definition at line 15 of file Field.h.

Constructor & Destructor Documentation

swarmros::introspection::Field::Field ( const std::string &  name,
const Serializer serializer 
)
inline

Construct a new Field object.

Parameters
nameName
serializerSerializer

Definition at line 41 of file Field.h.

Member Function Documentation

uint32_t Field::CalculateSerializedLength ( const swarmio::data::Variant &  value,
const FieldStack fieldStack 
) const
overridevirtual

Calculate the length of a serialized message in bytes.

Parameters
valueValue
fieldStackStack of fields to determine location
Returns
uint32_t

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ConstantField, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.

Definition at line 44 of file Field.cpp.

swarmio::data::Variant Field::Deserialize ( ros::serialization::IStream stream,
const FieldStack fieldStack 
) const
overridevirtual

Deserialize a stream into a variant.

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

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ConstantField, and swarmros::introspection::ArrayField.

Definition at line 76 of file Field.cpp.

swarmio::data::Variant Field::DeserializeArray ( ros::serialization::IStream stream,
uint32_t  count,
const FieldStack fieldStack 
) const
overridevirtual

Deserialize a stream into a variant array - not supported on Fields.

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

Implements swarmros::introspection::Serializer.

Definition at line 82 of file Field.cpp.

void Field::EmitDefault ( ros::serialization::OStream stream,
const FieldStack fieldStack 
) const
overridevirtual

Write the default value to the stream.

Parameters
streamOutput stream
fieldStackStack of fields to determine location

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ConstantField, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.

Definition at line 70 of file Field.cpp.

uint32_t Field::GetDefaultLength ( const FieldStack fieldStack) const
overridevirtual

Get the length of the default value.

Parameters
fieldStackStack of fields to determine location
Returns
uint32_t

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ConstantField, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.

Definition at line 38 of file Field.cpp.

swarmio::data::discovery::Field Field::GetFieldDescriptor ( ) const
overridevirtual

Build a field descriptor for the underlying type.

Returns
swarmio::data::discovery::Field

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ArrayField, and swarmros::introspection::FixedArrayField.

Definition at line 87 of file Field.cpp.

const Serializer& swarmros::introspection::Field::GetSerializer ( ) const
inline

Get the associated serializer.

Returns
const Serializer&

Definition at line 58 of file Field.h.

void Field::Serialize ( ros::serialization::OStream stream,
const swarmio::data::Variant &  value,
const FieldStack fieldStack 
) const
overridevirtual

Serialize a variant onto a stream.

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

Implements swarmros::introspection::Serializer.

Reimplemented in swarmros::introspection::ConstantField, and swarmros::introspection::ArrayField.

Definition at line 57 of file Field.cpp.

void Field::WriteDefinition ( std::stringstream &  stream,
bool  forHash 
) const
virtual

Write the definition of this field to a string stream.

Parameters
streamStream
forHashTrue if the definition will be used for the MD5 hash

Reimplemented in swarmros::introspection::ConstantField, swarmros::introspection::FixedArrayField, and swarmros::introspection::ArrayField.

Definition at line 12 of file Field.cpp.

void Field::WriteTypeName ( std::stringstream &  stream,
bool  forHash 
) const
protected

Get the type name for the serializer.

Parameters
streamStream
forHashTrue if the type name will be used for the MD5 hash

Definition at line 18 of file Field.cpp.

Member Data Documentation

const Serializer& swarmros::introspection::Field::_serializer
protected

Serializer.

Definition at line 23 of file Field.h.


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


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