COMMS
Template library intended to help with implementation of communication protocols.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Static Protected Member Functions | Related Symbols | List of all members
comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions > Class Template Reference

#include "comms/protocol/TransportValueLayer.h"

Detailed Description

template<typename TField, std::size_t TIdx, typename TNextLayer, typename... TOptions>
class comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >

Protocol layer that reads a value from transport wrapping and reassigns it to appropriate "extra transport" data member of the created message object.

Some protocols may put some values, which influence the way of how message contents are read and/or how the message is handled. For example protocol version information. This layer will read the field's value and will re-assign it to specified message object's "extra transport" data member field. This layer requires extra support from the defined message interface object - there is a need to pass comms::option::def::ExtraTransportFields option to the interface definition comms::Message class. This layer is a mid level layer, expects other mid level layer or MsgDataLayer to be its next one.

Template Parameters
TFieldType of the field that is used read / write extra transport value.
TIdxIndex of "extra transport" field that message object contains (accessed via comms::Message::transportFields()).
TNextLayerNext transport layer in protocol stack.
TOptionsExtending functionality options. Supported options are:
Inheritance diagram for comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >:
comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >

Public Types

using AllFields = typename std::decay< decltype(std::tuple_cat(std::declval< std::tuple< Field > >(), std::declval< typename TNextLayer::AllFields >())) >::type
 Type of all the fields of all the transport layers wrapped in std::tuple.
 
using AllMessages = typename NextLayer::AllMessages
 All supported messages.
 
using ExtendingClass = typename ParsedOptionsInternal::ExtendingClass
 Type of real extending class.
 
using Field = typename BaseImpl::Field
 Type of the field object used to read/write "sync" value.
 
using MsgFactory = typename NextLayer::MsgFactory
 Type of message factory.
 
using MsgPtr = typename details::ProtocolLayerMsgPtr< NextLayer >::Type
 Type of pointer to the message.
 
using NextLayer = TNextLayer
 Type of the next transport layer.
 
using ParsedOptions = details::ProtocolLayerBaseOptionsParser< TOptions... >
 Parsed options structure.
 
using ThisLayer = TDerived
 Actual derived class.
 

Public Member Functions

 TransportValueLayer ()=default
 Default constructor.
 
 TransportValueLayer (const TransportValueLayer &)=default
 Copy constructor.
 
 TransportValueLayer (TransportValueLayer &&)=default
 Move constructor.
 
 ~TransportValueLayer () noexcept=default
 Destructor.
 
template<typename TId >
MsgPtr createMsg (TId &&id, unsigned idx=0)
 Create message object given the ID.
 
template<typename TMsg , typename TIter , typename TNextLayerReader , typename... TExtraValues>
comms::ErrorStatus doRead (Field &field, TMsg &msg, TIter &iter, std::size_t size, TNextLayerReader &&nextLayerReader, TExtraValues... extraValues)
 Customized read functionality, invoked by read().
 
template<typename TMsg , typename TIter , typename TNextLayerUpdater >
comms::ErrorStatus doUpdate (const TMsg &msg, Field &field, TIter &iter, std::size_t size, TNextLayerUpdater &&nextLayerUpdater) const
 Default implementation of the "update" functaionality.
 
template<typename TIter , typename TNextLayerUpdater >
comms::ErrorStatus doUpdate (Field &field, TIter &iter, std::size_t size, TNextLayerUpdater &&nextLayerUpdater) const
 Default implementation of the "update" functaionality.
 
template<typename TMsg , typename TIter , typename TNextLayerWriter >
comms::ErrorStatus doWrite (Field &field, const TMsg &msg, TIter &iter, std::size_t size, TNextLayerWriter &&nextLayerWriter) const
 Customized write functionality, invoked by write().
 
constexpr std::size_t length () const
 Get remaining length of wrapping transport information.
 
template<typename TMsg >
constexpr std::size_t length (const TMsg &msg) const
 Get remaining length of wrapping transport information + length of the provided message.
 
NextLayernextLayer ()
 Get access to the next layer object.
 
const NextLayernextLayer () const
 Get "const" access to the next layer object.
 
FieldpseudoField ()
 Access to pseudo field stored internally.
 
const FieldpseudoField () const
 Const access to pseudo field stored internally.
 
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus read (TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Deserialise message from the input data sequence.
 
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus readFieldsCached (TAllFields &allFields, TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Deserialise message from the input data sequence while caching the read transport information fields.
 
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus readFromData (TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Finalise the read operation by reading the message payload.
 
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus readFromDataFieldsCached (TAllFields &allFields, TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Finalise the read operation by reading the message payload while caching the read transport information fields.
 
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus readUntilData (TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Perform read of data fields until data layer (message payload).
 
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus readUntilDataFieldsCached (TAllFields &allFields, TMsg &msg, TIter &iter, std::size_t size, TExtraValues... extraValues)
 Perform read of data fields until data layer (message payload) while caching the read transport information fields.
 
ThisLayerthisLayer ()
 Get access to this layer object.
 
const ThisLayerthisLayer () const
 Get "const" access to this layer object.
 
template<typename TMsg , typename TIter >
comms::ErrorStatus update (const TMsg &msg, TIter &iter, std::size_t size) const
 Update recently written (using write()) message contents data.
 
template<typename TIter >
comms::ErrorStatus update (TIter &iter, std::size_t size) const
 Update recently written (using write()) message contents data.
 
template<typename TAllFields , typename TMsg , typename TIter >
ErrorStatus updateFieldsCached (TAllFields &allFields, const TMsg &msg, TIter &iter, std::size_t size) const
 Update recently written (using writeFieldsCached()) message data as well as cached transport information fields.
 
template<typename TAllFields , typename TIter >
ErrorStatus updateFieldsCached (TAllFields &allFields, TIter &iter, std::size_t size) const
 Update recently written (using writeFieldsCached()) message data as well as cached transport information fields.
 
template<typename TMsg , typename TIter >
comms::ErrorStatus write (const TMsg &msg, TIter &iter, std::size_t size) const
 Serialise message into output data sequence.
 
template<typename TAllFields , typename TMsg , typename TIter >
comms::ErrorStatus writeFieldsCached (TAllFields &allFields, const TMsg &msg, TIter &iter, std::size_t size) const
 Serialise message into output data sequence while caching the written transport information fields.
 

Static Public Member Functions

template<typename TAllFields >
static auto accessCachedField (TAllFields &allFields) -> decltype(std::get< std::tuple_size< typename std::decay< TAllFields >::type >::value - std::tuple_size< AllFields >::value >(allFields))
 Access appropriate field from "cached" bundle of all the protocol stack fields.
 
static constexpr bool canSplitRead ()
 Compile time check whether split read "until" and "from" data layer is allowed.
 
static constexpr std::size_t doFieldLength ()
 Customising field length calculation.
 
template<typename TMsg >
static std::size_t doFieldLength (const TMsg &)
 Customising field length calculation.
 
static constexpr bool hasExtendingClass ()
 Compile time inquiry of whether this class was extended via comms::option::ExtendingClass option.
 
static constexpr bool hasPseudoValue ()
 Compile time inquiry of whether the comms::option::def::PseudoValue option has been used.
 

Static Public Attributes

static const std::size_t NumOfLayers = 1 + NextLayer::NumOfLayers
 Static constant indicating amount of transport layers used.
 

Protected Member Functions

template<typename TMsg >
bool reassignFieldValueToMsg (const Field &field, TMsg *msgPtr)
 Re-assign the value from the input field to appropriate transport field in the message object.
 
template<typename... TExtraValues>
void setMissingSize (std::size_t val, TExtraValues... extraValues) const
 Set the missing size information if such is requested.
 
template<typename TId , typename... TExtraValues>
void setMsgId (TId val, TExtraValues... extraValues) const
 Set the message ID information if such is requested.
 
template<typename... TExtraValues>
void setMsgIndex (std::size_t val, TExtraValues... extraValues) const
 Set the message index information if such is requested.
 
template<typename... TExtraValues>
void updateMissingSize (const Field &field, std::size_t size, TExtraValues... extraValues) const
 Update the missing size information if such is requested.
 
template<typename... TExtraValues>
void updateMissingSize (std::size_t size, TExtraValues... extraValues) const
 Update the missing size information if such is requested.
 

Static Protected Member Functions

template<typename TMsg , typename TIter >
static comms::ErrorStatus doReadField (const TMsg *msgPtr, Field &field, TIter &iter, std::size_t len)
 Read the layer field.
 
template<typename TMsg , typename TIter >
static comms::ErrorStatus doWriteField (const TMsg *msgPtr, const Field &field, TIter &iter, std::size_t len)
 Write the layer field.
 
template<std::size_t TIdx, typename TAllFields >
static FieldgetField (TAllFields &allFields)
 Retrieve reference to a layer specific field out of all fields.
 
template<typename T >
static constexpr bool isMessageObjRef ()
 Detect whether type is actual message object.
 
template<typename TMsg >
static void prepareFieldForWrite (const TMsg &msg, Field &field)
 Prepare field for writing.
 
template<typename TMsg >
static void reassignFieldValue (TMsg &msg, const Field &field)
 Re-assign the value from the input field to appropriate transport field in the message object.
 
template<typename TMsg >
static void resetMsg (TMsg &msg)
 Reset msg in case it is a smart pointer (MsgPtr).
 
template<typename TMsg >
static auto toMsgPtr (TMsg &msg) -> decltype(toMsgPtrInternal(msg, MsgTypeTag< typename std::decay< decltype(msg)>::type >()))
 Get a pointer to the message object.
 

Related Symbols

(Note that these are not member symbols.)

#define COMMS_PROTOCOL_LAYERS_ACCESS(...)    COMMS_DO_ACCESS_LAYER_ACC_FUNC(__VA_ARGS__)
 Provide convenience access functions to protocol layers.
 
#define COMMS_PROTOCOL_LAYERS_ACCESS_INNER(...)    COMMS_PROTOCOL_LAYERS_ACCESS(__VA_ARGS__)
 Same as COMMS_PROTOCOL_LAYERS_ACCESS()
 
#define COMMS_PROTOCOL_LAYERS_ACCESS_OUTER(...)    COMMS_PROTOCOL_LAYERS_ACCESS(COMMS_EXPAND(COMMS_REVERSE_MACRO_ARGS(__VA_ARGS__)))
 Provide convenience access functions to protocol layers.
 
#define COMMS_PROTOCOL_LAYERS_NAMES(...)
 Provide names and convenience access functions to protocol layers.
 
#define COMMS_PROTOCOL_LAYERS_NAMES_INNER(...)    COMMS_PROTOCOL_LAYERS_NAMES(__VA_ARGS__)
 Same as COMMS_PROTOCOL_LAYERS_NAMES()
 
#define COMMS_PROTOCOL_LAYERS_NAMES_OUTER(...)    COMMS_PROTOCOL_LAYERS_NAMES(COMMS_EXPAND(COMMS_REVERSE_MACRO_ARGS(__VA_ARGS__)))
 Provide names and convenience access functions to protocol layers.
 
template<typename T >
constexpr bool isTransportValueLayer ()
 Compile time check of whether the provided type is a variant of TransportValueLayer.
 

Member Typedef Documentation

◆ AllFields

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
using comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::AllFields = typename std::decay< decltype( std::tuple_cat( std::declval<std::tuple<Field> >(), std::declval<typename TNextLayer::AllFields>()) ) >::type
inherited

Type of all the fields of all the transport layers wrapped in std::tuple.

The Field type is prepended to the AllFields type of the NextLayer and reported as AllFields of this one.

◆ AllMessages

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
using comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::AllMessages = typename NextLayer::AllMessages
inherited

All supported messages.

Same as NextLayer::AllMessages or void if such doesn't exist. Expected to be overrided by comms::protocol::MsgIdLayer

◆ ExtendingClass

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
using comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::ExtendingClass = typename ParsedOptionsInternal::ExtendingClass

Type of real extending class.

Updated when comms::option::ExtendingClass extension option us used, aliasing void if the options is not used.

◆ MsgFactory

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
using comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::MsgFactory = typename NextLayer::MsgFactory
inherited

Type of message factory.

Same as NextLayer::AllMessages or void if such doesn't exist. Expected to be overrided by comms::protocol::MsgIdLayer

◆ MsgPtr

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
using comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::MsgPtr = typename details::ProtocolLayerMsgPtr<NextLayer>::Type
inherited

Type of pointer to the message.

Same as NextLayer::MsgPtr or void if such doesn't exist.

Member Function Documentation

◆ accessCachedField()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields >
static auto comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::accessCachedField ( TAllFields &  allFields) -> decltype(std::get<std::tuple_size<typename std::decay<TAllFields>::type>::value - std::tuple_size<AllFields>::value>(allFields))
staticinherited

Access appropriate field from "cached" bundle of all the protocol stack fields.

Parameters
allFieldsAll fields of the protocol stack
Returns
Reference to requested field.

◆ createMsg()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TId >
MsgPtr comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::createMsg ( TId &&  id,
unsigned  idx = 0 
)
inherited

Create message object given the ID.

The default implementation is to forwards this call to the next layer. One of the layers (usually comms::protocol::MsgIdLayer) hides and overrides this implementation.

Template Parameters
TMsgType of message ID.
Parameters
idID of the message.
idxRelative index of the message with the same ID.
Returns
Smart pointer (variant of std::unique_ptr) to allocated message object

◆ doFieldLength() [1/2]

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
static constexpr std::size_t comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::doFieldLength ( )
staticconstexpr

Customising field length calculation.

If the layer is marked as "pseudo" (using comms::option::def::PseudoValue) option, then the report length is 0.

◆ doFieldLength() [2/2]

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg >
static std::size_t comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::doFieldLength ( const TMsg &  )
static

Customising field length calculation.

If the layer is marked as "pseudo" (using comms::option::def::PseudoValue) option, then the report length is 0.

◆ doRead()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg , typename TIter , typename TNextLayerReader , typename... TExtraValues>
comms::ErrorStatus comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::doRead ( Field field,
TMsg &  msg,
TIter &  iter,
std::size_t  size,
TNextLayerReader &&  nextLayerReader,
TExtraValues...  extraValues 
)

Customized read functionality, invoked by read().

Reads the value from the input data and assigns it to appropriate extra transport field inside the message object (accessed via comms::Message::transportFields()).
Note, that this operation works fine even if message object is created after reading the transport value. There is "inner magic" that causes read operation to proceed until DATA layer (implemented by comms::protocol::MsgDataLayer), assigns the read value to message object, then proceeds to reading the message contents, i.e. when comms::Message::read() function is invoked the message object already has the value of the transport field updated.

Template Parameters
TMsgType of the msg parameter.
TIterType of iterator used for reading.
TNextLayerReadernext layer reader object type.
Parameters
[out]fieldField object to read.
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterInput iterator used for reading.
[in]sizeSize of the data in the sequence
[in]nextLayerReaderReader object, needs to be invoked to forward read operation to the next layer.
[out]extraValuesVariadic extra output parameters passed to the "read" operatation of the protocol stack (see read() and readFieldsCached()). Need to passed on as variadic arguments to the nextLayerReader.
Returns
Status of the read operation.
Precondition
Iterator must be valid and can be dereferenced and incremented at least "size" times;
Postcondition
The iterator will be advanced by the number of bytes was actually read. In case of an error, distance between original position and advanced will pinpoint the location of the error.

◆ doReadField()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter >
static comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::doReadField ( const TMsg *  msgPtr,
Field field,
TIter &  iter,
std::size_t  len 
)
staticprotectedinherited

Read the layer field.

The default implementation invokes read() operation of the passed field object. The function can be overriden by the extending class.

Parameters
[in]msgPtrPointer to message object (if available), can be nullptr.
[out]fieldField object value of which needs to be populated
[in,out]iterIterator used for reading, expected to be advanced
[in]lenLength of the input buffer
Note
May be non-static in the extending class

◆ doUpdate() [1/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter , typename TNextLayerUpdater >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::doUpdate ( const TMsg &  msg,
Field field,
TIter &  iter,
std::size_t  size,
TNextLayerUpdater &&  nextLayerUpdater 
) const
inherited

Default implementation of the "update" functaionality.

Similar to other doUpdate() but also receiving recently written message object.

Template Parameters
TMsgType of message object.
TIterType of iterator used for updating.
TNextLayerWriternext layer updater object type.
Parameters
[in]msgReference to message object.
[out]fieldField that needs to be updated.
[in,out]iterAny random access iterator.
[in]sizeNumber of bytes that have been written using write().
[in]nextLayerUpdaterNext layer updater object.

◆ doUpdate() [2/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TIter , typename TNextLayerUpdater >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::doUpdate ( Field field,
TIter &  iter,
std::size_t  size,
TNextLayerUpdater &&  nextLayerUpdater 
) const
inherited

Default implementation of the "update" functaionality.

It will be invoked by update() or updateFieldsCached() member function, unless the derived class provides its own doUpdate() member function to override the default behavior.
This function in this layer does nothing, just advances the iterator by the length of the Field.

Template Parameters
TIterType of iterator used for updating.
TNextLayerWriternext layer updater object type.
Parameters
[out]fieldField that needs to be updated.
[in,out]iterAny random access iterator.
[in]sizeNumber of bytes that have been written using write().
[in]nextLayerUpdaterNext layer updater object.

◆ doWrite()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg , typename TIter , typename TNextLayerWriter >
comms::ErrorStatus comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::doWrite ( Field field,
const TMsg &  msg,
TIter &  iter,
std::size_t  size,
TNextLayerWriter &&  nextLayerWriter 
) const

Customized write functionality, invoked by write().

The function will write the appriprate extra transport value held by the message object being written.

Template Parameters
TMsgType of message object.
TIterType of iterator used for writing.
TNextLayerWriternext layer writer object type.
Parameters
[out]fieldField object to update and write.
[in]msgReference to message object
[in,out]iterOutput iterator.
[in]sizeMax number of bytes that can be written.
[in]nextLayerWriterNext layer writer object.
Returns
Status of the write operation.
Precondition
Iterator must be valid and can be dereferenced and incremented at least "size" times;
Postcondition
The iterator will be advanced by the number of bytes was actually written. In case of an error, distance between original position and advanced will pinpoint the location of the error.

◆ doWriteField()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter >
static comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::doWriteField ( const TMsg *  msgPtr,
const Field field,
TIter &  iter,
std::size_t  len 
)
staticprotectedinherited

Write the layer field.

The default implementation invokes write() operation of the passed field object. The function can be overriden by the extending class.

Parameters
[in]msgPtrPointer to message object (if available), can be nullptr.
[out]fieldField object value of which needs to be written
[in,out]iterIterator used for writing, expected to be advanced
[in]lenLength of the output buffer
Note
May be non-static in the extending class, but needs to be const.

◆ getField()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<std::size_t TIdx, typename TAllFields >
static Field & comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::getField ( TAllFields &  allFields)
staticprotectedinherited

Retrieve reference to a layer specific field out of all fields.

Template Parameters
TIdxIndex of the field in tuple

◆ hasExtendingClass()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
static constexpr bool comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::hasExtendingClass ( )
staticconstexpr

Compile time inquiry of whether this class was extended via comms::option::ExtendingClass option.

If true is returned, the ExtendingClass type aliasing the real layer type.

◆ isMessageObjRef()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename T >
static constexpr bool comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::isMessageObjRef ( )
staticconstexprprotectedinherited

Detect whether type is actual message object.

Template Parameters
TType of the object
Returns
true if T type is extending comms::MessageBase, false otherwise.

◆ length() [1/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
constexpr std::size_t comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::length ( ) const
constexprinherited

Get remaining length of wrapping transport information.

The message data always get wrapped with transport information to be successfully delivered to and unpacked on the other side. This function return remaining length of the transport information. It performs a call to doFieldLength() member function to get info about current field length. To update the default behaviour just override the function in the derived class.

Returns
length of the field + length reported by the next layer.

◆ length() [2/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg >
constexpr std::size_t comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::length ( const TMsg &  msg) const
constexprinherited

Get remaining length of wrapping transport information + length of the provided message.

This function usually gets called when there is a need to identify the size of the buffer required to write provided message wrapped in the transport information. This function is very similar to length(), but adds also length of the message. It performs a call to doFieldLength() member function with message parameter to get info about current field length. To update the default behaviour just override the function in the derived class.

Template Parameters
TMsgType of message object.
Parameters
[in]msgMessage object
Returns
length of the field + length reported by the next layer.

◆ prepareFieldForWrite()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg >
static void comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::prepareFieldForWrite ( const TMsg &  msg,
Field field 
)
staticprotected

Prepare field for writing.

Copies the field value from the appropriate transport field of the message object and assigns it to the provided output field.
May be overridden by the extending class if some complex functionality is required.

Parameters
[in]msgReference to message object being written
[out]fieldField, value of which needs to be populated
Note
May be non-static in the extending class

◆ pseudoField() [1/2]

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
Field & comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::pseudoField ( )

Access to pseudo field stored internally.

The function exists only if comms::option::def::PseudoValue option has been used.

◆ pseudoField() [2/2]

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
const Field & comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::pseudoField ( ) const

Const access to pseudo field stored internally.

The function exists only if comms::option::def::PseudoValue option has been used.

◆ read()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::read ( TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Deserialise message from the input data sequence.

The function will invoke doRead() member function provided by the derived class, which must have the following signature and logic:

template<typename TMsg, typename TIter, typename TNextLayerReader, typename... TExtraValues>
Field& field, // field object used to read required data
TMsg& msg, // Ref to smart pointer to message object, or message object itself
TIter& iter, // iterator used for reading
std::size_t size, // size of the remaining data
TNextLayerReader&& nextLayerReader, // next layer reader object
TExtraValues... extraValues)
{
// internal logic prior next layer read, such as reading the field value
auto es = field.read(iter, size);
...
// request next layer to perform read operation
es = nextLayerReader.read(msg, iter, size - field.length(), extraValues...);
... // internal logic after next layer read if applicable
return es;
};
comms::ErrorStatus doRead(Field &field, TMsg &msg, TIter &iter, std::size_t size, TNextLayerReader &&nextLayerReader, TExtraValues... extraValues)
Customized read functionality, invoked by read().
Definition TransportValueLayer.h:169
typename BaseImpl::Field Field
Type of the field object used to read/write "sync" value.
Definition TransportValueLayer.h:100
ErrorStatus
Error statuses reported by the Communication module.
Definition ErrorStatus.h:17

The signature of the nextLayerReader.read() function is the same as the signature of this read() member function. The implemented doRead() member function also may use the following inherited protected member to set values of variadic parameters in case they are provided.

  • updateMissingSize() - to calculate update missing size if such is requested.
  • setMissingSize() - to set specific value as missing size if suce information is requested.
  • setMsgId() - to set the value of message id
  • setMsgIndex() - to set the value of message index.
    Template Parameters
    TMsgType of msg parameter
    TIterType of iterator used for reading.
    Parameters
    [in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
    [in,out]iterInput iterator used for reading.
    [in]sizeSize of the data in the sequence
    [out]extraValuesExtra output parameters provided using one of the following functions: comms::protocol::missingSize(), comms::protocol::msgId(), comms::protocol::msgIndex(), comms::protocol::msgPayload().
    Returns
    Status of the operation.
    Precondition
    Iterator must be valid and can be dereferenced and incremented at least "size" times;
    Postcondition
    The iterator will be advanced by the number of bytes was actually read. In case of an error, distance between original position and advanced will pinpoint the location of the error.
    Returns comms::ErrorStatus::Success if and only if msg points to a valid object.

◆ readFieldsCached()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::readFieldsCached ( TAllFields &  allFields,
TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Deserialise message from the input data sequence while caching the read transport information fields.

Very similar to read() member function, but adds "allFields" parameter to store read transport information fields. The function will also invoke the same doRead() member function provided by the derived class, as described with read().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TMsgType of msg parameter.
TIterType of iterator used for reading.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterIterator used for reading.
[in]sizeNumber of bytes available for reading.
[out]extraValuesExtra output parameters provided using one of the following functions
Returns
Status of the operation.

◆ readFromData()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::readFromData ( TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Finalise the read operation by reading the message payload.

Should be called to finalise the read operation started by readUntilData().

Template Parameters
TMsgType of msg parameter
TIterType of iterator used for reading.
Parameters
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterInput iterator used for reading.
[in]sizeSize of the data in the sequence
[out]extraValuesExtra output parameters provided using one of the following functions
Returns
Status of the operation.
Precondition
Iterator must be valid and can be dereferenced and incremented at least "size" times;
Postcondition
The iterator will be advanced by the number of bytes was actually read. In case of an error, distance between original position and advanced will pinpoint the location of the error.

◆ readFromDataFieldsCached()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::readFromDataFieldsCached ( TAllFields &  allFields,
TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Finalise the read operation by reading the message payload while caching the read transport information fields.

Should be called to finalise the read operation started by readUntilDataFieldsCached().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TMsgType of msg parameter
TIterType of iterator used for reading.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterIterator used for reading.
[in]sizeNumber of bytes available for reading.
[out]extraValuesExtra output parameters provided using one of the following functions
Returns
Status of the operation.

◆ readUntilData()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::readUntilData ( TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Perform read of data fields until data layer (message payload).

Same as read by stops read operation when data layer is reached. Expected to be followed by a call to readFromData().

Template Parameters
TMsgType of msg parameter.
TIterType of iterator used for reading.
Parameters
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterInput iterator used for reading.
[in]sizeSize of the data in the sequence
[out]extraValuesExtra output parameters provided using one of the following functions
Returns
Status of the operation.
Precondition
Iterator must be valid and can be dereferenced and incremented at least "size" times;
Postcondition
The iterator will be advanced by the number of bytes was actually read. In case of an error, distance between original position and advanced will pinpoint the location of the error.
missingSize output value is updated if and only if function returns comms::ErrorStatus::NotEnoughData.

◆ readUntilDataFieldsCached()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TMsg , typename TIter , typename... TExtraValues>
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::readUntilDataFieldsCached ( TAllFields &  allFields,
TMsg &  msg,
TIter &  iter,
std::size_t  size,
TExtraValues...  extraValues 
)
inherited

Perform read of data fields until data layer (message payload) while caching the read transport information fields.

Very similar to readUntilData() member function, but adds "allFields" parameter to store read transport information fields. The function will also invoke the same doRead() member function provided by the derived class, as described with read().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TMsgType of msg parameter
TIterType of iterator used for reading.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in,out]msgReference to smart pointer, that already holds or will hold allocated message object, or reference to actual message object (which extends comms::MessageBase).
[in,out]iterIterator used for reading.
[in]sizeNumber of bytes available for reading.
[out]extraValuesExtra output parameters provided using one of the following functions
Returns
Status of the operation.

◆ reassignFieldValue()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg >
static void comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::reassignFieldValue ( TMsg &  msg,
const Field field 
)
staticprotected

Re-assign the value from the input field to appropriate transport field in the message object.

Default implementation just assigns to the field accessed using TIdx index passed as the template argument to the class definition.
May be overridden by the extending class if some complex functionality is required.

Parameters
[out]msgReference to the created message object
[in]fieldField, value of which needs to be re-assigned
Deprecated:
Use reassignFieldValueToMsg() instead.

◆ reassignFieldValueToMsg()

template<typename TField , std::size_t TIdx, typename TNextLayer , typename... TOptions>
template<typename TMsg >
bool comms::protocol::TransportValueLayer< TField, TIdx, TNextLayer, TOptions >::reassignFieldValueToMsg ( const Field field,
TMsg *  msgPtr 
)
protected

Re-assign the value from the input field to appropriate transport field in the message object.

Default implementation just assigns to the field accessed using TIdx index passed as the template argument to the class definition.
May be overridden by the extending class if some complex functionality is required.

Parameters
[in]fieldField, value of which needs to be re-assigned
[in,out]msgPtrPointer to the created message object
Returns
true in case of successful operation, false othewise
In case false is returned, the doRead() member function will return comms::ErrorStatus::ProtocolError.
Note
May be non-static in the extending class

◆ resetMsg()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg >
static void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::resetMsg ( TMsg &  msg)
staticprotectedinherited

Reset msg in case it is a smart pointer (MsgPtr).

Does nothing if passed parameter is actual message object.

See also
isMessageObjRef().

◆ setMissingSize()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename... TExtraValues>
void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::setMissingSize ( std::size_t  val,
TExtraValues...  extraValues 
) const
protectedinherited

Set the missing size information if such is requested.

Updates the value reference to which was passed to the "read" operation using comms::protocol::missingSize().

Parameters
[in]valValue to assign.
[out]extraValuesVariadic parameters passed to the "read" function such as read() or readFieldsCached()

◆ setMsgId()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TId , typename... TExtraValues>
void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::setMsgId ( TId  val,
TExtraValues...  extraValues 
) const
protectedinherited

Set the message ID information if such is requested.

Updates the value reference to which was passed to the "read" operation using comms::protocol::msgId().

Parameters
[in]valValue to assign.
[out]extraValuesVariadic parameters passed to the "read" function such as read() or readFieldsCached()

◆ setMsgIndex()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename... TExtraValues>
void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::setMsgIndex ( std::size_t  val,
TExtraValues...  extraValues 
) const
protectedinherited

Set the message index information if such is requested.

Updates the value reference to which was passed to the "read" operation using comms::protocol::msgIndex().

Parameters
[in]valValue to assign.
[out]extraValuesVariadic parameters passed to the "read" function such as read() or readFieldsCached()

◆ toMsgPtr()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg >
static auto comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::toMsgPtr ( TMsg &  msg) -> decltype(toMsgPtrInternal(msg, MsgTypeTag<typename std::decay<decltype(msg)>::type>()))
staticprotectedinherited

Get a pointer to the message object.

The function works seamlessly for both smart pointer and reference to the real object

See also
isMessageObjRef().

◆ update() [1/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::update ( const TMsg &  msg,
TIter &  iter,
std::size_t  size 
) const
inherited

Update recently written (using write()) message contents data.

Similar to other update() but also receiving recently written message object.

Parameters
[in]msgReference to message object.
[in,out]iterAny random access iterator.
[in]sizeNumber of bytes that have been written using write().
Returns
Status of the update operation.

◆ update() [2/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TIter >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::update ( TIter &  iter,
std::size_t  size 
) const
inherited

Update recently written (using write()) message contents data.

Sometimes, when NON random access iterator is used for writing (for example std::back_insert_iterator), some transport data cannot be properly written. In this case, write() function will return comms::ErrorStatus::UpdateRequired. When such status is returned it is necessary to call update() with random access iterator on the written buffer to update written dummy information with proper values.
The function will invoke doUpdate() member function provided (or inherited) by the derived class, which must have the following signature and logic:

template<typename TIter, typename TNextLayerUpdater>
Field& field, // field object to update and re-write if necessary
TIter& iter, // iterator used for updateing
std::size_t size, // Number of remaning bytes in the output buffer.
TNextLayerUpdater&& nextLayerUpdater // next layer updater object
)
{
// internal logic prior next layer update, such as
// updating field's value and re-writing it.
field.value() = ...;
auto es = field.write(iter, size);
...
// request next layer to perform update operation
es = nextLayerUpdater.update(iter, size - field.length());
... // internal logic after next layer write if applicable
return es;
};
comms::ErrorStatus doUpdate(Field &field, TIter &iter, std::size_t size, TNextLayerUpdater &&nextLayerUpdater) const
Default implementation of the "update" functaionality.
Definition ProtocolLayerBase.h:707

The signature of the nextLayerUpdater.update() function is the same as the signature of this update() member function.

Parameters
[in,out]iterAny random access iterator.
[in]sizeNumber of bytes that have been written using write().
Returns
Status of the update operation.

◆ updateFieldsCached() [1/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TMsg , typename TIter >
ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::updateFieldsCached ( TAllFields &  allFields,
const TMsg &  msg,
TIter &  iter,
std::size_t  size 
) const
inherited

Update recently written (using writeFieldsCached()) message data as well as cached transport information fields.

Very similar to other updateFieldsCached() member function, but adds "msg" parameter to access message object if needed.
The function will also invoke the same doUpdate() member function provided by the derived class, as described with write().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TMsgType of msg parameter.
TIterType of the random access iterator.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in]msgReference to recently written message object.
[in,out]iterRandom access iterator to the written data.
[in]sizeNumber of bytes that have been written using writeFieldsCached().
Returns
Status of the update operation.

◆ updateFieldsCached() [2/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TIter >
ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::updateFieldsCached ( TAllFields &  allFields,
TIter &  iter,
std::size_t  size 
) const
inherited

Update recently written (using writeFieldsCached()) message data as well as cached transport information fields.

Very similar to update() member function, but adds "allFields" parameter to store raw data of the message.
The function will also invoke the same doUpdate() member function provided by the derived class, as described with write().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TIterType of the random access iterator.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in,out]iterRandom access iterator to the written data.
[in]sizeNumber of bytes that have been written using writeFieldsCached().
Returns
Status of the update operation.

◆ updateMissingSize() [1/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename... TExtraValues>
void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::updateMissingSize ( const Field field,
std::size_t  size,
TExtraValues...  extraValues 
) const
protectedinherited

Update the missing size information if such is requested.

Calculates the minimal required length to be yet read. Updates the value reference to which was passed to the "read" operation using comms::protocol::missingSize().

Parameters
[in]fieldField read operation of which has failed.
[in]sizeRemaining number of bytes in the input buffer.
[out]extraValuesVariadic parameters passed to the "read" function such as read() or readFieldsCached()

◆ updateMissingSize() [2/2]

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename... TExtraValues>
void comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::updateMissingSize ( std::size_t  size,
TExtraValues...  extraValues 
) const
protectedinherited

Update the missing size information if such is requested.

Calculates the minimal required length to be yet read. Updates the value reference to which was passed to the "read" operation using comms::protocol::missingSize().

Parameters
[in]sizeRemaining number of bytes in the input buffer.
[out]extraValuesVariadic parameters passed to the "read" function such as read() or readFieldsCached()

◆ write()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TMsg , typename TIter >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::write ( const TMsg &  msg,
TIter &  iter,
std::size_t  size 
) const
inherited

Serialise message into output data sequence.

The function will invoke doWrite() member function provided by the derived class, which must have the following signature and logic:

template<typename TMsg, typename TIter, typename TNextLayerWriter>
Field& field, // field object used to update and write required data
const TMsg& msg, // reference to ready to be sent message object
TIter& iter, // iterator used for writing
std::size_t size, // Max number of bytes that can be written.
TNextLayerWriter&& nextLayerWriter // next layer writer object
)
{
// internal logic prior next layer write, such as
// updating field's value and writing it.
field.value() = ...;
auto es = field.write(iter, size);
...
// request next layer to perform write operation
es = nextLayerWriter.write(msg, iter, size - field.length());
... // internal logic after next layer write if applicable
return es;
};
comms::ErrorStatus doWrite(Field &field, const TMsg &msg, TIter &iter, std::size_t size, TNextLayerWriter &&nextLayerWriter) const
Customized write functionality, invoked by write().
Definition TransportValueLayer.h:225

The signature of the nextLayerWriter.write() function is the same as the signature of this write() member function.

Template Parameters
TMsgType of the message being written.
TIterType of iterator used for writing.
Parameters
[in]msgReference to message object
[in,out]iterOutput iterator used for writing.
[in]sizeMax number of bytes that can be written.
Returns
Status of the write operation.
Precondition
Iterator must be valid and can be dereferenced and incremented at least "size" times;
Postcondition
The iterator will be advanced by the number of bytes was actually written. In case of an error, distance between original position and advanced will pinpoint the location of the error.
Returns
Status of the write operation.

◆ writeFieldsCached()

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
template<typename TAllFields , typename TMsg , typename TIter >
comms::ErrorStatus comms::protocol::ProtocolLayerBase< TField, TNextLayer, TDerived, TOptions >::writeFieldsCached ( TAllFields &  allFields,
const TMsg &  msg,
TIter &  iter,
std::size_t  size 
) const
inherited

Serialise message into output data sequence while caching the written transport information fields.

Very similar to write() member function, but adds "allFields" parameter to store raw data of the message. The function will also invoke the same doWrite() member function provided by the derived class, as described with write().

Template Parameters
TAllFieldsstd::tuple of all the transport fields, must be AllFields type defined in the last layer class that defines protocol stack.
TMsgType of the message being written.
TIterType of iterator used for writing.
Parameters
[out]allFieldsReference to the std::tuple object that wraps all transport fields (AllFields type of the last protocol layer class).
[in]msgReference to the message object that is being written,
[in,out]iterIterator used for writing.
[in]sizeMax number of bytes that can be written.
Returns
Status of the write operation.

Friends And Related Symbol Documentation

◆ COMMS_PROTOCOL_LAYERS_ACCESS

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
#define COMMS_PROTOCOL_LAYERS_ACCESS (   ...)     COMMS_DO_ACCESS_LAYER_ACC_FUNC(__VA_ARGS__)
related

Provide convenience access functions to protocol layers.

The first argument is a name for innermost layer (comms::protocol::MsgDataLayer), while the last one is the name for the outermost one.

◆ COMMS_PROTOCOL_LAYERS_ACCESS_OUTER

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
#define COMMS_PROTOCOL_LAYERS_ACCESS_OUTER (   ...)     COMMS_PROTOCOL_LAYERS_ACCESS(COMMS_EXPAND(COMMS_REVERSE_MACRO_ARGS(__VA_ARGS__)))
related

Provide convenience access functions to protocol layers.

Similar to COMMS_PROTOCOL_LAYERS_ACCESS(), but the arguments are expected to be in reverse order, i.e. the first argument is the name of the outermost layer, while the last one is the name for the innermost one (comms::protocol::MsgDataLayer)

◆ COMMS_PROTOCOL_LAYERS_NAMES

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
#define COMMS_PROTOCOL_LAYERS_NAMES (   ...)
related
Value:
COMMS_DO_LAYER_TYPE_ALIAS(Base, __VA_ARGS__) \
COMMS_DO_ACCESS_LAYER_ACC_FUNC(__VA_ARGS__)

Provide names and convenience access functions to protocol layers.

Similar to COMMS_PROTOCOL_LAYERS_ACCESS() but defines "Layer_<name>" type names.

Precondition
Requires definition of inner "Base" type aliasing the base class.

◆ COMMS_PROTOCOL_LAYERS_NAMES_OUTER

template<typename TField , typename TNextLayer , typename TDerived , typename... TOptions>
#define COMMS_PROTOCOL_LAYERS_NAMES_OUTER (   ...)     COMMS_PROTOCOL_LAYERS_NAMES(COMMS_EXPAND(COMMS_REVERSE_MACRO_ARGS(__VA_ARGS__)))
related

Provide names and convenience access functions to protocol layers.

Similar to COMMS_PROTOCOL_LAYERS_ACCESS_OUTER() but defines "Layer_<name>" type names.

Precondition
Requires definition of inner "Base" type aliasing the base class.

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