RMW desert 1.0
|
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. | |
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.
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.
msg | Pointer to the first byte of the message in memory |
casted_members | Pointer to the member containing type support informations |
stream | The stream used to receive data |
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.
member | Pointer to the member containing type support informations |
field | Pointer to the destination memory address of the elementary data |
stream | The stream used to receive data |
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.
member | Pointer to the member containing type support informations |
field | Pointer to the destination memory address of the elementary data |
stream | The stream used to receive data |
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.
msg | Pointer to the first byte of the message in memory |
casted_members | Pointer to the member containing type support informations |
stream | The stream used to send data |
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.
member | Pointer to the member containing type support informations |
field | Pointer to the origin memory address of the elementary data |
stream | The stream used to send data |
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.
member | Pointer to the member containing type support informations |
field | Pointer to the origin memory address of the elementary data |
stream | The stream used to send data |