Class with functions to convert between xtypes::DynamicData and fast-dds DynamicData.
#include <Converter.hpp>
|
static bool | xtypes_to_fastdds (const eprosima::xtypes::DynamicData &input, eprosima::fastrtps::types::DynamicData *output) |
| Converts from xtypes to fastdds DynamicData. More...
|
|
static bool | fastdds_to_xtypes (const eprosima::fastrtps::types::DynamicData *input, eprosima::xtypes::DynamicData &output) |
| Converts from fastdds to xtypes DynamicData. More...
|
|
static eprosima::xtypes::DynamicData | dynamic_data (const std::string &type_name) |
| Retrieve a dynamic data instance given type name. More...
|
|
static void | register_type (const std::string &type_name, eprosima::fastrtps::types::DynamicPubSubType *type) |
| Registers a fastdds pub sub type with provided type name. More...
|
|
static void | register_xtype (const std::string &type_name, const eprosima::xtypes::DynamicType &type) |
| Registers a xtypes type with provided type name. More...
|
|
static eprosima::fastrtps::types::DynamicTypeBuilder * | create_builder (const eprosima::xtypes::DynamicType &type) |
| Return fastdds DynamicTypeBuilder given xtypes DynamicType. More...
|
|
static std::string | convert_type_name (const std::string &message_type) |
| Patches type names with '/' in their type name. More...
|
|
static const eprosima::xtypes::DynamicType & | resolve_discriminator_type (const eprosima::xtypes::DynamicType &service_type, const std::string &discriminator) |
| Retrieve member type of aggregated type. More...
|
|
static eprosima::xtypes::WritableDynamicDataRef | access_member_data (eprosima::xtypes::WritableDynamicDataRef membered_data, const std::string &path) |
| Retrieve a writable dynamic data reference member. More...
|
|
static void | clear_data_structures () |
| Clear converter data structures. More...
|
|
◆ access_member_data()
eprosima::xtypes::WritableDynamicDataRef ddsfmu::Converter::access_member_data |
( |
eprosima::xtypes::WritableDynamicDataRef |
membered_data, |
|
|
const std::string & |
path |
|
) |
| |
|
static |
Recursively navigate dynamic data ref until leaf member is found. Returns the corresponding writable dynamic data reference.
- Parameters
-
[in] | membered_data | Instance of data reference to search in |
[in] | path | Path to member with '.' to separate members. |
◆ clear_data_structures()
static void ddsfmu::Converter::clear_data_structures |
( |
| ) |
|
|
inlinestatic |
Clear internal std::maps. It is useful to call this before deleting DDS participants to avoid invalid reads of deleted log resources.
◆ convert_type_name()
std::string ddsfmu::Converter::convert_type_name |
( |
const std::string & |
message_type | ) |
|
|
static |
Replaces '/' with "__" and returns the patched name.
- Parameters
-
[in] | message_type | Type name |
- Returns
- Patched type name
◆ create_builder()
DynamicTypeBuilder * ddsfmu::Converter::create_builder |
( |
const eprosima::xtypes::DynamicType & |
type | ) |
|
|
static |
Retrieves a DynamicTypeBuilder and internally creates it if not already created by the DynamicTypeBuilderFactory. The xtypes dynamic type is converted into fast-dds dynamic type. This function makes necessary API calls to ensure that many xtypes type kinds are mapped out as analogous fast-dds dynamic types, including arrays, structured types, and union types.
- Parameters
-
[in] | type | xtypes DynamicType for which to create a DynamicTypeBuilder |
- Returns
- DynamicTypeBuilder pointer
◆ dynamic_data()
eprosima::xtypes::DynamicData ddsfmu::Converter::dynamic_data |
( |
const std::string & |
type_name | ) |
|
|
static |
Get dynamic data given type name. This function looks up the dynamic typein a map of registered eprosima::xtypes::DynamicType::Ptr.
- Parameters
-
[in] | type_name | Name of type to retrieve |
- Returns
- Instance of DynamicData
◆ fastdds_to_xtypes()
bool ddsfmu::Converter::fastdds_to_xtypes |
( |
const eprosima::fastrtps::types::DynamicData * |
input, |
|
|
eprosima::xtypes::DynamicData & |
output |
|
) |
| |
|
static |
This function takes an fast-dds DynamicData pointer and converts it into an xtypes DynamicData reference. If the conversion is successful, the function returns true.
- Parameters
-
[in] | input | fastdds DynamicData pointer |
[out] | output | xtypes DynamicData reference |
- Returns
- Boolean on result of operation
◆ register_type()
static void ddsfmu::Converter::register_type |
( |
const std::string & |
type_name, |
|
|
eprosima::fastrtps::types::DynamicPubSubType * |
type |
|
) |
| |
|
inlinestatic |
Registers DynamicPubSubType in a map, associating it with the given type name.
- Parameters
-
[in] | type_name | Name of type to register |
[in] | type | Pointer to dynamic type to be registered |
◆ register_xtype()
static void ddsfmu::Converter::register_xtype |
( |
const std::string & |
type_name, |
|
|
const eprosima::xtypes::DynamicType & |
type |
|
) |
| |
|
inlinestatic |
Registers DynamicType in a map, associating it with the given type name.
- Parameters
-
[in] | type_name | Name of type to register |
[in] | type | Reference to dynamic type to be registered |
◆ resolve_discriminator_type()
const xtypes::DynamicType & ddsfmu::Converter::resolve_discriminator_type |
( |
const eprosima::xtypes::DynamicType & |
service_type, |
|
|
const std::string & |
discriminator |
|
) |
| |
|
static |
Iteratively resolves member types in discriminator string until deepest member is found. The members are separated by '.'. Returns the DynamicType of this member.
- Parameters
-
[in] | service_type | Type with member type |
[in] | discriminator | Nested name of member |
- Returns
- Resolved DynamicType
◆ xtypes_to_fastdds()
bool ddsfmu::Converter::xtypes_to_fastdds |
( |
const eprosima::xtypes::DynamicData & |
input, |
|
|
eprosima::fastrtps::types::DynamicData * |
output |
|
) |
| |
|
static |
This function takes an xtypes DynamicData reference and converts it into a fast-dds DynamicData pointer. If the conversion is successful, the function returns true.
- Parameters
-
[in] | input | xtypes DynamicData reference |
[out] | output | fastdds DynamicData pointer |
- Returns
- Boolean on result of operation