RTI Connext Modern C++ API
Version 6.1.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. More... | |
std::string | name () const |
Gets the name. More... | |
Related Functions | |
(Note that these are not member functions.) | |
bool | is_primitive_type (const DynamicType &t) |
Determines if a DynamicType is a PrimitiveType. More... | |
bool | is_constructed_type (const DynamicType &t) |
Determines if a DynamicType is a constructed type. More... | |
bool | is_collection_type (const DynamicType &t) |
Determines if a DynamicType is a CollectionType. More... | |
bool | is_aggregation_type (const DynamicType &t) |
Determines if a DynamicType is an aggregation type. More... | |
std::ostream & | operator<< (std::ostream &out, const DynamicType &type) |
<<extension>> Converts the DynamicType to a string. More... | |
void | print_idl (const DynamicType &type, unsigned int indent=0) |
<<extension>> Prints the IDL representation of this DynamicType to the standard output More... | |
std::ostream & | to_string (std::ostream &out, const DynamicType &type, const rti::core::xtypes::DynamicTypePrintFormatProperty &format=DynamicTypePrintFormatProperty()) |
<<extension>> Writes the string representation of this DynamicType to an output stream. More... | |
std::string | to_string (const DynamicType &type, const rti::core::xtypes::DynamicTypePrintFormatProperty &format=DynamicTypePrintFormatProperty()) |
<<extension>> Creates the string representation of this DynamicType to a string. More... | |
<<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>> Converts the DynamicType to a string.
This operator writes the DynamicType type to the ostream out using default values for DynamicTypePrintFormatProperty and returns a reference to out.
|
related |
<<extension>> Prints the IDL representation of this DynamicType to the standard output
|
related |
<<extension>> Writes the string representation of this DynamicType to an output stream.
out | The output stream to which the string representation of the DynamicType should be printed. |
type | The DynamicType to be printed. |
format | The DynamicTypePrintFormatProperty used to define the format of the string. |
|
related |
<<extension>> Creates the string representation of this DynamicType to a string.
type | The DynamicType to be printed. |
format | The DynamicTypePrintFormatProperty used to define the format of the string. |