RTI Connext Modern C++ API
Version 5.3.1
|
<<value-type>> Represents a runtime type. More...
#include "dds/core/xtypes/DynamicType.hpp"
Public Member Functions | |
dds::core::xtypes::TypeKind | kind () const |
Gets the type kind. | |
std::string | name () const |
Gets the name. | |
Related Functions | |
(Note that these are not member functions.) | |
bool | is_primitive_type (const DynamicType &t) |
Determines if a DynamicType is a PrimitiveType. | |
bool | is_constructed_type (const DynamicType &t) |
Determines if a DynamicType is a constructed type. | |
bool | is_collection_type (const DynamicType &t) |
Determines if a DynamicType is a CollectionType. | |
bool | is_aggregation_type (const DynamicType &t) |
Determines if a DynamicType is an aggregation type. | |
void | print_idl (const DynamicType &type, unsigned int indent=0) |
<<extension>> Prints the IDL representation of this type to the standard output | |
<<value-type>> Represents a runtime type.
A DynamicType is a mechanism for representing a type at runtime. DynamicTypes allow the reflective manipulation of data (DynamicData) and the inspection of the type information about discovered readers and writers.
You can obtain a DynamicType in a few different ways:
For examples, see DynamicType and DynamicData Use Cases
This an abstract base class of all the types. This class contains all of the internal state—derived classes don't add any new state. That means that it is safe to copy a DynamicType without slicing.
To downcast a DynamicType into a concrete class, you can check its kind() and then apply a static_cast to the appropriate class.
For example, let's assume we have the following IDL type:
We obtain the type of Foo
and want to know the type of its member bar:
dds::core::xtypes::TypeKind dds::core::xtypes::DynamicType::kind | ( | ) | const |
Gets the type kind.
std::string dds::core::xtypes::DynamicType::name | ( | ) | const |
Gets the name.
|
related |
Determines if a DynamicType is a PrimitiveType.
|
related |
Determines if a DynamicType is a constructed type.
This includes EnumType, AliasType, collection types and aggregation types.
|
related |
Determines if a DynamicType is a CollectionType.
This includes ArrayType, SequenceType, StringType, and WStringType.
|
related |
Determines if a DynamicType is an aggregation type.
This includes StructType and UnionType.
|
related |
<<extension>> Prints the IDL representation of this type to the standard output