18#include <fastrtps/types/DynamicData.h>
19#include <fastrtps/types/DynamicPubSubType.h>
20#include <fastrtps/types/DynamicType.h>
21#include <fastrtps/types/DynamicTypeBuilder.h>
22#include <fastrtps/types/DynamicTypeBuilderPtr.h>
23#include <xtypes/idl/idl.hpp>
24#include <xtypes/xtypes.hpp>
43 const eprosima::xtypes::DynamicData& input, eprosima::fastrtps::types::DynamicData* output);
56 const eprosima::fastrtps::types::DynamicData* input, eprosima::xtypes::DynamicData& output);
67 static eprosima::xtypes::DynamicData
dynamic_data(
const std::string& type_name);
79 const std::string& type_name, eprosima::fastrtps::types::DynamicPubSubType* type) {
80 m_registered_types.emplace(type_name, type);
93 const std::string& type_name,
const eprosima::xtypes::DynamicType& type) {
94 m_types.insert_or_assign(type_name, type);
107 static eprosima::fastrtps::types::DynamicTypeBuilder*
133 const eprosima::xtypes::DynamicType& service_type,
const std::string& discriminator);
146 eprosima::xtypes::WritableDynamicDataRef membered_data,
const std::string& path);
157 m_registered_types.clear();
163 static std::map<std::string, eprosima::xtypes::DynamicType::Ptr> m_types;
164 static std::map<std::string, eprosima::fastrtps::types::DynamicPubSubType*> m_registered_types;
165 static std::map<std::string, eprosima::fastrtps::types::DynamicTypeBuilder_ptr> m_builders;
167 static const eprosima::xtypes::DynamicType&
168 resolve_type(
const eprosima::xtypes::DynamicType& type);
169 static eprosima::fastrtps::types::TypeKind
170 resolve_type(
const eprosima::fastrtps::types::DynamicType_ptr type);
171 static eprosima::fastrtps::types::DynamicTypeBuilder_ptr
172 get_builder(
const eprosima::xtypes::DynamicType& type);
174 static void get_array_specs(
175 const eprosima::xtypes::ArrayType& array,
176 std::pair<std::vector<uint32_t>, eprosima::fastrtps::types::DynamicTypeBuilder_ptr>& result);
179 eprosima::xtypes::WritableDynamicDataRef membered_data,
const std::vector<std::string>& tokens,
183 static void set_primitive_data(
184 eprosima::xtypes::ReadableDynamicDataRef from, eprosima::fastrtps::types::DynamicData* to,
185 eprosima::fastrtps::types::MemberId
id);
186 static void set_sequence_data(
187 eprosima::xtypes::ReadableDynamicDataRef from, eprosima::fastrtps::types::DynamicData* to);
188 static void set_map_data(
189 eprosima::xtypes::ReadableDynamicDataRef from, eprosima::fastrtps::types::DynamicData* to);
190 static void set_array_data(
191 eprosima::xtypes::ReadableDynamicDataRef from, eprosima::fastrtps::types::DynamicData* to,
192 const std::vector<uint32_t>& indexes);
193 static bool set_struct_data(
194 eprosima::xtypes::ReadableDynamicDataRef input, eprosima::fastrtps::types::DynamicData* output);
195 static bool set_union_data(
196 eprosima::xtypes::ReadableDynamicDataRef input, eprosima::fastrtps::types::DynamicData* output);
200 static void set_sequence_data(
201 const eprosima::fastrtps::types::DynamicData* from,
202 eprosima::xtypes::WritableDynamicDataRef to);
203 static void set_map_data(
204 const eprosima::fastrtps::types::DynamicData* from,
205 eprosima::xtypes::WritableDynamicDataRef to);
206 static void set_array_data(
207 const eprosima::fastrtps::types::DynamicData* from, eprosima::xtypes::WritableDynamicDataRef to,
208 const std::vector<uint32_t>& indexes);
209 static bool set_struct_data(
210 const eprosima::fastrtps::types::DynamicData* input,
211 eprosima::xtypes::WritableDynamicDataRef output);
212 static bool set_union_data(
213 const eprosima::fastrtps::types::DynamicData* input,
214 eprosima::xtypes::WritableDynamicDataRef output);
Definition: auxiliaries.cpp:26
Class with functions to convert between xtypes::DynamicData and fast-dds DynamicData.
Definition: Converter.hpp:31
static void register_type(const std::string &type_name, eprosima::fastrtps::types::DynamicPubSubType *type)
Registers a fastdds pub sub type with provided type name.
Definition: Converter.hpp:78
static std::string convert_type_name(const std::string &message_type)
Patches type names with '/' in their type name.
Definition: Converter.cpp:55
static void register_xtype(const std::string &type_name, const eprosima::xtypes::DynamicType &type)
Registers a xtypes type with provided type name.
Definition: Converter.hpp:92
static bool xtypes_to_fastdds(const eprosima::xtypes::DynamicData &input, eprosima::fastrtps::types::DynamicData *output)
Converts from xtypes to fastdds DynamicData.
Definition: Converter.cpp:500
static eprosima::fastrtps::types::DynamicTypeBuilder * create_builder(const eprosima::xtypes::DynamicType &type)
Return fastdds DynamicTypeBuilder given xtypes DynamicType.
Definition: Converter.cpp:1723
static eprosima::xtypes::WritableDynamicDataRef access_member_data(eprosima::xtypes::WritableDynamicDataRef membered_data, const std::string &path)
Retrieve a writable dynamic data reference member.
Definition: Converter.cpp:1911
static eprosima::xtypes::DynamicData dynamic_data(const std::string &type_name)
Retrieve a dynamic data instance given type name.
Definition: Converter.cpp:1708
static void clear_data_structures()
Clear converter data structures.
Definition: Converter.hpp:155
static bool fastdds_to_xtypes(const eprosima::fastrtps::types::DynamicData *input, eprosima::xtypes::DynamicData &output)
Converts from fastdds to xtypes DynamicData.
Definition: Converter.cpp:1327
static const eprosima::xtypes::DynamicType & resolve_discriminator_type(const eprosima::xtypes::DynamicType &service_type, const std::string &discriminator)
Retrieve member type of aggregated type.
Definition: Converter.cpp:1889