RTI Connext Modern C++ API
Version 6.1.2
|
Provides functions to serialize and deserialize user data types to and from CDR format. More...
Functions | |
template<typename TopicType > | |
void | rti::topic::from_cdr_buffer_no_alloc (TopicType &sample, const std::vector< char > &buffer) |
Deserializes a sample from a buffer of bytes in CDR format. More... | |
template<typename TopicType > | |
TopicType | rti::topic::from_cdr_buffer (const std::vector< char > &buffer) |
Creates a sample by deserializing a buffer of bytes in CDR format. More... | |
template<typename TopicType > | |
std::vector< char > & | rti::topic::to_cdr_buffer (std::vector< char > &buffer, const TopicType &sample, dds::core::policy::DataRepresentationId representation) |
Serializes a sample into a buffer of octets in CDR format. More... | |
template<typename TopicType > | |
std::vector< char > & | rti::topic::to_cdr_buffer (std::vector< char > &buffer, const TopicType &sample) |
Serializes a sample into a buffer of octets in CDR format. More... | |
Provides functions to serialize and deserialize user data types to and from CDR format.
DDS serializes topic-types into bytes in CDR format to transmit them between DataWriters and DataReaders. The functions rti::topic::to_cdr() and rti::topic::from_cdr() expose this functionality so applications can take advantage of this capability.
void rti::topic::from_cdr_buffer_no_alloc | ( | TopicType & | sample, |
const std::vector< char > & | buffer | ||
) |
Deserializes a sample from a buffer of bytes in CDR format.
dds::topic::topic_type_support<TopicType>::initialize_sample()
. This precondition doesn't apply if TopicType
is dds::core::xtypes::DynamicData
This function does the same as from_cdr_buffer() but it doesn't create a new sample. When deserializing multiple samples this operation will be more efficient.
TopicType | A valid topic-type. Valid types are IDL-generated types, the built-in types and dds::core::xtypes::DynamicData. |
sample | The destination (see precondition) |
buffer | The CDR buffer to deserialize |
References rti::topic::from_cdr_buffer().
Referenced by rti::topic::from_cdr_buffer().
TopicType rti::topic::from_cdr_buffer | ( | const std::vector< char > & | buffer | ) |
Creates a sample by deserializing a buffer of bytes in CDR format.
TopicType | A valid topic-type. Valid types are IDL-generated types, the built-in types and dds::core::xtypes::DynamicData. |
buffer | The CDR buffer to desrialize |
References rti::topic::from_cdr_buffer_no_alloc().
Referenced by rti::topic::from_cdr_buffer_no_alloc().
std::vector<char>& rti::topic::to_cdr_buffer | ( | std::vector< char > & | buffer, |
const TopicType & | sample, | ||
dds::core::policy::DataRepresentationId | representation | ||
) |
Serializes a sample into a buffer of octets in CDR format.
TopicType | A valid topic-type. Valid types are IDL-generated types, the built-in types and dds::core::xtypes::DynamicData. |
buffer | The destination buffer. It will be resized to fit the serialized sample |
sample | The sample to serialize |
representation | The representation to serialize the data into |
buffer
References rti::topic::to_cdr_buffer().
std::vector<char>& rti::topic::to_cdr_buffer | ( | std::vector< char > & | buffer, |
const TopicType & | sample | ||
) |
Serializes a sample into a buffer of octets in CDR format.
This overload uses dds::core::policy::DataRepresentationId::auto_id() as the data representation.
Referenced by rti::topic::to_cdr_buffer().