RTI Connext Modern C++ API  Version 6.0.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rti::topic::dynamic_type< TopicType > Struct Template Reference

Provides a DynamicType that represents an IDL-generated type. More...

#include <rti/topic/TopicTraits.hpp>

Detailed Description

template<typename TopicType>
struct rti::topic::dynamic_type< TopicType >

Provides a DynamicType that represents an IDL-generated type.

This type is specialized for IDL-generated types to provide a get() function whose return type is a const reference to a concrete subclass of dds::core::xtypes::DynamicType, such as dds::core::xtypes::StructType, dds::core::xtypes::UnionType, dds::core::xtypes::EnumType.

For example, given the following IDL type Foo:

struct Foo {
long x;

You can obtain its DynamicType (in this case a StructType) as follows:

std::cout << foo_dynamic.name() << std::endl; // Output: Foo

Note that if the type is an IDL alias such as the following:

typedef Foo Bar;

Then rti::topic::dynamic_type<Bar> resolves to rti::topic::dynamic_type<Foo>, both returning the same StructType. If you want to explicitly access the AliasType use the special tag type Bar_AliasTag_t:

std::cout << bar_dynamic.name() << std::endl; // Output: Bar
See Also

RTI Connext Modern C++ API Version 6.0.0 Copyright © Sun Mar 3 2019 Real-Time Innovations, Inc