Goby3  3.0.1
2021.08.17
goby::middleware::SerializerParserHelper< DataType, scheme, Enable > Struct Template Reference

Class for parsing and serializing a given marshalling scheme. Must be specialized for a particular scheme and/or DataType. More...

#include <goby/middleware/marshalling/interface.h>

Static Public Member Functions

static std::vector< charserialize (const DataType &)
 Given data, produce a vector of bytes. More...
 
static std::string type_name ()
 The marshalling scheme specific string name for this type. More...
 
static std::string type_name (const DataType &)
 The marshalling scheme specific string name for this type, given a instantiation of the type (useful for specializations that can handle multiple types using runtime introspection) More...
 
template<typename CharIterator >
static std::shared_ptr< DataType > parse (CharIterator bytes_begin, CharIterator bytes_end, CharIterator &actual_end, const std::string &type=type_name())
 Given a beginning and end iterator to bytes, parse the data and return it. More...
 

Detailed Description

template<typename DataType, int scheme, class Enable = void>
struct goby::middleware::SerializerParserHelper< DataType, scheme, Enable >

Class for parsing and serializing a given marshalling scheme. Must be specialized for a particular scheme and/or DataType.

Template Parameters
DataTypedata type that the specialization can handle
schemescheme that the specialization can handle
EnableSFINAE enable/disable type using type_traits for specializaing this struct

Definition at line 96 of file interface.h.

Member Function Documentation

◆ parse()

template<typename DataType , int scheme, class Enable = void>
template<typename CharIterator >
static std::shared_ptr<DataType> goby::middleware::SerializerParserHelper< DataType, scheme, Enable >::parse ( CharIterator  bytes_begin,
CharIterator  bytes_end,
CharIterator &  actual_end,
const std::string &  type = type_name() 
)
inlinestatic

Given a beginning and end iterator to bytes, parse the data and return it.

Template Parameters
CharIteratoran iterator to a container of bytes (char), e.g. std::vector<char>::iterator, or std::string::iterator
Parameters
bytes_beginIterator to the beginning of a container of bytes
bytes_endIterator to the end of a container of bytes
actual_endWill be set to the actual end of parsing by this specialization (useful for byte streams that are concatenated, e.g. DCCL)
typeType name as string. If type_name() can be defined without parameters, the default value should be set, otherwise omit it (for dynamic types like google::protobuf::Message)
Returns
shared pointer to the parsed message

Definition at line 128 of file interface.h.

◆ serialize()

template<typename DataType , int scheme, class Enable = void>
static std::vector<char> goby::middleware::SerializerParserHelper< DataType, scheme, Enable >::serialize ( const DataType &  )
inlinestatic

Given data, produce a vector of bytes.

Definition at line 99 of file interface.h.

◆ type_name() [1/2]

template<typename DataType , int scheme, class Enable = void>
static std::string goby::middleware::SerializerParserHelper< DataType, scheme, Enable >::type_name ( )
inlinestatic

The marshalling scheme specific string name for this type.

Definition at line 106 of file interface.h.

◆ type_name() [2/2]

template<typename DataType , int scheme, class Enable = void>
static std::string goby::middleware::SerializerParserHelper< DataType, scheme, Enable >::type_name ( const DataType &  )
inlinestatic

The marshalling scheme specific string name for this type, given a instantiation of the type (useful for specializations that can handle multiple types using runtime introspection)

Definition at line 113 of file interface.h.


The documentation for this struct was generated from the following file: