RTI Connext Modern C++ API  Version 5.3.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::core::xtypes Namespace Reference

<<extension>> Extensions to dds::core::xtypes More...

Classes

class  LoanedDynamicData
 <<move-only-type>> Gives temporary access to a member of another DynamicData object. More...
 
class  DynamicDataInfo
 Contains information about a DynamicData sample. More...
 
class  DynamicDataMemberInfo
 Contains information about a DynamicData member. More...
 
class  DynamicDataTypeSerializationProperty
 <<extension>> <<value-type>> Configures aspects of the memory management in the serialization of dds::core::xtypes::DynamicData samples. More...
 

Functions

template<typename TopicType >
DynamicDataImpl convert (const TopicType &sample)
 <<extension>> Creates a DynamicData sample from a typed sample
 
const
dds::core::xtypes::DynamicType
resolve_alias (const dds::core::xtypes::DynamicType &type)
 <<extension>> If the type is an alias returns its related type recursively until it is not an alias.
 
std::vector< char > & to_cdr_buffer (std::vector< char > &buffer, const DynamicData &sample)
 <<extension>> Serializes a DynamicData sample into CDR format
 
DynamicData & from_cdr_buffer (DynamicData &sample, const std::vector< char > &buffer)
 <<extension>> Creates a DynamicData sample by deserializing a CDR buffer'
 
template<typename TopicType >
TopicType convert (const DynamicData &sample)
 <<extension>> Creates a typed sample from a DynamicData sample.
 
template<typename TopicType >
bool can_convert (const DynamicData &sample)
 <<extension>> Determines if the DynamicType of this sample is equal to the DynamicType of TopicType
 
template<typename... Types>
std::tuple< Types...> get_tuple (const dds::core::xtypes::DynamicData &data)
 <<C++11>> <<experimental>> <<extension>> Retrieves all the values of a DynamicData object into an std::tuple at once
 
template<typename... Types>
void set_tuple (dds::core::xtypes::DynamicData &data, const std::tuple< Types...> &value)
 <<C++11>> <<experimental>> <<extension>> Assigns the values of a std::tuple to a DynamicData object at once
 
template<typename... Types>
dds::core::xtypes::StructType create_type_from_tuple (const std::string &name)
 <<C++11>> <<experimental>> <<extension>> Creates a StructType from a list of types or a std::tuple
 
void print_idl (const DynamicType &type, unsigned int indent=0)
 <<extension>> Prints the IDL representation of this type to the standard output
 

Detailed Description

Function Documentation

template<typename TopicType >
DynamicData rti::core::xtypes::convert ( const TopicType &  sample)

<<extension>> Creates a DynamicData sample from a typed sample

Template Parameters
TopicTypeAn IDL topic-type
Parameters
sampleThe typed sample to convert to DynamicData
Returns
A new DynamicData object whose type is rti::topic::dynamic_type<TopicType> and contains the data from sample
const dds::core::xtypes::DynamicType & rti::core::xtypes::resolve_alias ( const dds::core::xtypes::DynamicType type)

<<extension>> If the type is an alias returns its related type recursively until it is not an alias.

std::vector< char > & rti::core::xtypes::to_cdr_buffer ( std::vector< char > &  buffer,
const DynamicData &  sample 
)

<<extension>> Serializes a DynamicData sample into CDR format

Parameters
bufferThe output buffer, which will be resized to the correct size
sampleThe sample to serialize
Returns
A reference to buffer
DynamicData & rti::core::xtypes::from_cdr_buffer ( DynamicData &  sample,
const std::vector< char > &  buffer 
)

<<extension>> Creates a DynamicData sample by deserializing a CDR buffer'

Parameters
sampleThe sample to deserialize.
bufferThe buffer containing the CDR data
Returns
A reference to sample
template<typename TopicType >
TopicType rti::core::xtypes::convert ( const DynamicData &  sample)

<<extension>> Creates a typed sample from a DynamicData sample.

This function is useful when an application uses DynamicData and regular typed Topics at the same time.

For example, given this IDL type:

struct Foo {
long x;
};

We can convert from Foo and DynamicData:

// Receive a DynamicData sample
assert (samples.size() > 0);
// Create a Foo sample
const DynamicData& dynamic_data = samples[0].data();
assert (can_convert<Foo>(dynamic_data));
Foo typed_data = convert<Foo>(dynamic_data);
assert (typed_data.x() == dynamic_data.value<int32_t>("x"));
Precondition
can_convert<TopicType>(sample), otherwise the behavior is undefined.
Template Parameters
TopicTypeAn IDL topic-type
Parameters
sampleThe DynamicData sample to convert to type TopicType
Returns
An instance of TopicType containing the data in sample.
template<typename TopicType >
bool rti::core::xtypes::can_convert ( const DynamicData &  sample)

<<extension>> Determines if the DynamicType of this sample is equal to the DynamicType of TopicType

Template Parameters
TopicTypeAn IDL topic-type
Returns
True if the DynamicType of TopicType is the same as this sample's and therefore it is possible to create an instance of TopicType from this DynamicData object.
See Also
convert()
template<typename... Types>
std::tuple< Types...> rti::core::xtypes::get_tuple ( const dds::core::xtypes::DynamicData data)

<<C++11>> <<experimental>> <<extension>> Retrieves all the values of a DynamicData object into an std::tuple at once

See Also
Manipulating data reflectively using C++ tuples
template<typename... Types>
void rti::core::xtypes::set_tuple ( dds::core::xtypes::DynamicData data,
const std::tuple< Types...> &  value 
)

<<C++11>> <<experimental>> <<extension>> Assigns the values of a std::tuple to a DynamicData object at once

See Also
Manipulating data reflectively using C++ tuples
template<typename... Types>
dds::core::xtypes::StructType rti::core::xtypes::create_type_from_tuple ( const std::string &  name)

<<C++11>> <<experimental>> <<extension>> Creates a StructType from a list of types or a std::tuple

Template Parameters
TypesA list of types or a std::tuple. The types must be primitive (see dds::core::xtypes::PrimitiveType) or std::string.

The StructType members are all default-created (i.e. non-key, non-optional, with default IDs...) and their names are m0, m1, m2, etc.

See Also
Create a DynamicType using tuples
void rti::core::xtypes::print_idl ( const DynamicType &  type,
unsigned int  indent = 0 
)

<<extension>> Prints the IDL representation of this type to the standard output


RTI Connext Modern C++ API Version 5.3.1 Copyright © Mon Feb 19 2018 Real-Time Innovations, Inc