RMW desert 1.0
Loading...
Searching...
No Matches
Functions
MessageSerialization Namespace Reference

Namespace containing serialization functions. More...

Functions

template<typename T >
void serialize_field (const INTROSPECTION_CPP_MEMBER *member, void *field, cbor::TxStream &stream)
 Serialize a C++ field.
 
template<typename T >
void serialize_field (const INTROSPECTION_C_MEMBER *member, void *field, cbor::TxStream &stream)
 Serialize a C field.
 
template<typename MembersType >
void serialize (const void *msg, const MembersType *casted_members, cbor::TxStream &stream)
 Serialize a ROS message, request or response.
 
template<typename T >
void deserialize_field (const INTROSPECTION_CPP_MEMBER *member, void *field, cbor::RxStream &stream)
 Deserialize a C++ field.
 
template<typename T >
void deserialize_field (const INTROSPECTION_C_MEMBER *member, void *field, cbor::RxStream &stream)
 Deserialize a C field.
 
template<typename MembersType >
void deserialize (void *msg, const MembersType *casted_members, cbor::RxStream &stream)
 Deserialize a ROS message, request or response.
 

Detailed Description

Namespace containing serialization functions.

The message data structure coming from upper layers is interpreted using type support informations passed by ROS2 during the creation of publishers, subscribers, clients and services. Those functions are used to compute the exact position that every data type must assume in memory an then calls TxStream or RxStream to receive or write them in the assigned location.

Function Documentation

◆ deserialize()

template<typename MembersType >
void MessageSerialization::deserialize ( void msg,
const MembersType casted_members,
cbor::RxStream stream 
)

Deserialize a ROS message, request or response.

Every time DESERT receives data from the channel a memory location is used to store the corresponding member type, and this function merges all the elementary C or C++ types into the whole message. To perform this operation the deserialize_field function is called to decode every specific data.

Parameters
msgPointer to the first byte of the message in memory
casted_membersPointer to the member containing type support informations
streamThe stream used to receive data

◆ deserialize_field() [1/2]

template<typename T >
void MessageSerialization::deserialize_field ( const INTROSPECTION_C_MEMBER *  member,
void field,
cbor::RxStream stream 
)

Deserialize a C field.

The type support introspection information is used to know if a specific data type is a single item, a sequence or a variable length sequence. Based on this conclusion a specific interpretation is passed to the stream.

Parameters
memberPointer to the member containing type support informations
fieldPointer to the destination memory address of the elementary data
streamThe stream used to receive data

◆ deserialize_field() [2/2]

template<typename T >
void MessageSerialization::deserialize_field ( const INTROSPECTION_CPP_MEMBER *  member,
void field,
cbor::RxStream stream 
)

Deserialize a C++ field.

The type support introspection information is used to know if a specific data type is a single item, a sequence or a vector. Based on this conclusion a specific interpretation is passed to the stream.

Parameters
memberPointer to the member containing type support informations
fieldPointer to the destination memory address of the elementary data
streamThe stream used to receive data

◆ serialize()

template<typename MembersType >
void MessageSerialization::serialize ( const void msg,
const MembersType casted_members,
cbor::TxStream stream 
)

Serialize a ROS message, request or response.

Every time ROS has data to send in the channel a memory location is passed with the corresponding message member type, and this function separates all the fields into elementary C or C++ types. Then the serialize_field function is called to encode the specific data.

Parameters
msgPointer to the first byte of the message in memory
casted_membersPointer to the member containing type support informations
streamThe stream used to send data

◆ serialize_field() [1/2]

template<typename T >
void MessageSerialization::serialize_field ( const INTROSPECTION_C_MEMBER *  member,
void *  field,
cbor::TxStream stream 
)

Serialize a C field.

The type support introspection information is used to know if a specific data type is a single item, a sequence or a variable length sequence. Based on this conclusion a specific interpretation is passed to the stream.

Parameters
memberPointer to the member containing type support informations
fieldPointer to the origin memory address of the elementary data
streamThe stream used to send data

◆ serialize_field() [2/2]

template<typename T >
void MessageSerialization::serialize_field ( const INTROSPECTION_CPP_MEMBER *  member,
void *  field,
cbor::TxStream stream 
)

Serialize a C++ field.

The type support introspection information is used to know if a specific data type is a single item, a sequence or a vector. Based on this conclusion a specific interpretation is passed to the stream.

Parameters
memberPointer to the member containing type support informations
fieldPointer to the origin memory address of the elementary data
streamThe stream used to send data