Fast RTPS  Version 2.1.0
Fast RTPS
DynamicTypeBuilderFactory.h
1 // Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef TYPES_DYNAMIC_TYPE_BUILDER_FACTORY_H
16 #define TYPES_DYNAMIC_TYPE_BUILDER_FACTORY_H
17 
18 #include <fastrtps/types/TypesBase.h>
19 #include <fastrtps/types/AnnotationParameterValue.h>
20 #include <fastrtps/types/DynamicTypePtr.h>
21 #include <mutex>
22 
23 //#define DISABLE_DYNAMIC_MEMORY_CHECK
24 
25 namespace eprosima {
26 namespace fastrtps {
27 namespace types {
28 
29 class AnnotationDescriptor;
30 class DynamicTypeBuilder;
31 class TypeDescriptor;
32 class TypeIdentifier;
33 class MemberDescriptor;
34 class TypeObject;
35 class DynamicType;
36 class DynamicType_ptr;
37 class AnnotationParameterValue;
38 
40 {
41 protected:
43 
44  inline void add_builder_to_list(DynamicTypeBuilder* pBuilder);
45 
47 
49  const TypeDescriptor* descriptor,
50  TypeObject& object,
51  bool complete = true) const;
52 
54  const TypeDescriptor* descriptor) const;
55 
57  const TypeDescriptor* descriptor) const;
58 
60  const TypeDescriptor* descriptor,
61  TypeObject& object,
62  bool complete = true) const;
63 
65  const TypeDescriptor* descriptor,
66  TypeObject& object,
67  bool complete = true) const;
68 
70  const TypeDescriptor* descriptor,
71  TypeObject& object,
72  bool complete = true) const;
73 
75  const TypeDescriptor* descriptor,
76  TypeObject& object,
77  const std::vector<const MemberDescriptor*> members,
78  bool complete = true) const;
79 
81  const TypeDescriptor* descriptor,
82  TypeObject& object,
83  const std::vector<const MemberDescriptor*> members,
84  bool complete = true) const;
85 
87  const TypeDescriptor* descriptor,
88  TypeObject& object,
89  const std::vector<const MemberDescriptor*> members,
90  bool complete = true) const;
91 
93  const TypeDescriptor* descriptor,
94  TypeObject& object,
95  const std::vector<const MemberDescriptor*> members,
96  bool complete = true) const;
97 
99  const TypeDescriptor* descriptor,
100  TypeObject& object,
101  const std::vector<const MemberDescriptor*> members,
102  bool complete = true) const;
103 
105  const TypeDescriptor* descriptor,
106  TypeObject& object,
107  const std::vector<const MemberDescriptor*> members,
108  bool complete = true) const;
109 
112  const MemberDescriptor* member) const;
113 
115  AppliedAnnotationSeq& annotations,
116  const TypeDescriptor* descriptor) const;
117 
118 #ifndef DISABLE_DYNAMIC_MEMORY_CHECK
119  std::vector<DynamicTypeBuilder*> builders_list_;
120  mutable std::recursive_mutex mutex_;
121 #endif
122 
123 public:
125 
126  RTPS_DllAPI static ReturnCode_t delete_instance();
127 
129 
131 
133 
135 
137  const TypeDescriptor* descriptor,
138  const std::string& name = "");
139 
141 
143 
145 
147 
149 
151 
153 
155 
157 
159 
161 
163 
165 
167 
169 
171 
173  const DynamicTypeBuilder* element_type,
174  uint32_t bound = MAX_ELEMENTS_COUNT);
175 
177  const DynamicType_ptr type,
178  uint32_t bound = MAX_ELEMENTS_COUNT);
179 
181  const DynamicTypeBuilder* element_type,
182  const std::vector<uint32_t>& bounds);
183 
185  const DynamicType_ptr type,
186  const std::vector<uint32_t>& bounds);
187 
189  DynamicTypeBuilder* key_element_type,
190  DynamicTypeBuilder* element_type,
191  uint32_t bound = MAX_ELEMENTS_COUNT);
192 
194  DynamicType_ptr key_type,
195  DynamicType_ptr value_type,
196  uint32_t bound = MAX_ELEMENTS_COUNT);
197 
198  RTPS_DllAPI DynamicTypeBuilder* create_bitmask_builder(uint32_t bound);
199 
201 
203  DynamicTypeBuilder* base_type,
204  const std::string& sName);
205 
207  DynamicType_ptr base_type,
208  const std::string& sName);
209 
211 
213 
215 
216  RTPS_DllAPI DynamicTypeBuilder* create_union_builder(DynamicTypeBuilder* discriminator_type);
217 
218  RTPS_DllAPI DynamicTypeBuilder* create_union_builder(DynamicType_ptr discriminator_type);
219 
220  RTPS_DllAPI DynamicType_ptr create_annotation_primitive(const std::string& name);
221 
223  const TypeDescriptor* descriptor,
224  const std::string& name = "");
225 
226  RTPS_DllAPI DynamicType_ptr create_type(const DynamicTypeBuilder* other);
227 
229  DynamicTypeBuilder* base_type,
230  const std::string& sName);
231 
233  DynamicType_ptr base_type,
234  const std::string& sName);
235 
237 
239 
241 
243 
245 
247 
249 
251 
253 
255 
257 
259 
261 
262  RTPS_DllAPI DynamicType_ptr create_string_type(uint32_t bound = MAX_STRING_LENGTH);
263 
265 
266  RTPS_DllAPI DynamicType_ptr create_bitset_type(uint32_t bound);
267 
268  RTPS_DllAPI void build_type_identifier(
269  const DynamicType_ptr type,
270  TypeIdentifier& identifier,
271  bool complete = true) const;
272 
273  RTPS_DllAPI void build_type_identifier(
274  const TypeDescriptor* descriptor,
275  TypeIdentifier& identifier,
276  bool complete = true) const;
277 
278  RTPS_DllAPI void build_type_object(
279  const DynamicType_ptr type,
280  TypeObject& object,
281  bool complete = true,
282  bool force = false) const;
283 
284  RTPS_DllAPI void build_type_object(
285  const TypeDescriptor* descriptor,
286  TypeObject& object,
287  const std::vector<const MemberDescriptor*>* members = nullptr,
288  bool complete = true,
289  bool force = false) const;
290 
291  RTPS_DllAPI bool is_empty() const;
292 };
293 
294 } // namespace types
295 } // namespace fastrtps
296 } // namespace eprosima
297 
298 #endif // TYPES_DYNAMIC_TYPE_BUILDER_FACTORY_H
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_type_object
RTPS_DllAPI void build_type_object(const DynamicType_ptr type, TypeObject &object, bool complete=true, bool force=false) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_struct_type_code
void build_struct_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_char8_builder
RTPS_DllAPI DynamicTypeBuilder * create_char8_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::add_builder_to_list
void add_builder_to_list(DynamicTypeBuilder *pBuilder)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::~DynamicTypeBuilderFactory
~DynamicTypeBuilderFactory()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_wstring_type
RTPS_DllAPI DynamicType_ptr create_wstring_type(uint32_t bound=MAX_STRING_LENGTH)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_type
RTPS_DllAPI DynamicType_ptr create_type(const TypeDescriptor *descriptor, const std::string &name="")
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_sequence_builder
RTPS_DllAPI DynamicTypeBuilder * create_sequence_builder(const DynamicType_ptr type, uint32_t bound=MAX_ELEMENTS_COUNT)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_union_builder
RTPS_DllAPI DynamicTypeBuilder * create_union_builder(DynamicTypeBuilder *discriminator_type)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint32_builder
RTPS_DllAPI DynamicTypeBuilder * create_uint32_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::builders_list_
std::vector< DynamicTypeBuilder * > builders_list_
Definition: DynamicTypeBuilderFactory.h:119
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_enum_builder
RTPS_DllAPI DynamicTypeBuilder * create_enum_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_char16_type
RTPS_DllAPI DynamicType_ptr create_char16_type()
eprosima::fastrtps::types::DynamicType
Definition: DynamicType.h:38
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int16_type
RTPS_DllAPI DynamicType_ptr create_int16_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_string_type
RTPS_DllAPI DynamicType_ptr create_string_type(uint32_t bound=MAX_STRING_LENGTH)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint16_builder
RTPS_DllAPI DynamicTypeBuilder * create_uint16_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_map_builder
RTPS_DllAPI DynamicTypeBuilder * create_map_builder(DynamicTypeBuilder *key_element_type, DynamicTypeBuilder *element_type, uint32_t bound=MAX_ELEMENTS_COUNT)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_sequence_type_code
void build_sequence_type_code(const TypeDescriptor *descriptor, TypeObject &object, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_custom_builder
RTPS_DllAPI DynamicTypeBuilder * create_custom_builder(const TypeDescriptor *descriptor, const std::string &name="")
eprosima::fastrtps::types::DynamicTypeBuilderFactory::apply_type_annotations
void apply_type_annotations(AppliedAnnotationSeq &annotations, const TypeDescriptor *descriptor) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint32_type
RTPS_DllAPI DynamicType_ptr create_uint32_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_sequence_builder
RTPS_DllAPI DynamicTypeBuilder * create_sequence_builder(const DynamicTypeBuilder *element_type, uint32_t bound=MAX_ELEMENTS_COUNT)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_bitset_type_code
void build_bitset_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::TypeDescriptor
Definition: TypeDescriptor.h:29
eprosima::fastrtps::types::MemberDescriptor
Definition: MemberDescriptor.h:29
eprosima::fastrtps::types::MAX_STRING_LENGTH
const int32_t MAX_STRING_LENGTH
Definition: TypesBase.h:278
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_byte_type
RTPS_DllAPI DynamicType_ptr create_byte_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_array_type_code
void build_array_type_code(const TypeDescriptor *descriptor, TypeObject &object, bool complete=true) const
eprosima::fastrtps::types::TypeIdentifier
Definition: TypeIdentifier.h:81
eprosima::fastrtps::types::AnnotationParameterValue
This class represents the union AnnotationParameterValue defined by the user in the IDL file.
Definition: AnnotationParameterValue.h:149
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_type_identifier
RTPS_DllAPI void build_type_identifier(const DynamicType_ptr type, TypeIdentifier &identifier, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_annotation_type_code
void build_annotation_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_child_struct_builder
RTPS_DllAPI DynamicTypeBuilder * create_child_struct_builder(DynamicTypeBuilder *parent_type)
eprosima::fastrtps::types::TypeKind
octet TypeKind
Definition: TypesBase.h:115
eprosima::fastrtps::types::DynamicTypeBuilder
Definition: DynamicTypeBuilder.h:32
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint64_builder
RTPS_DllAPI DynamicTypeBuilder * create_uint64_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float128_type
RTPS_DllAPI DynamicType_ptr create_float128_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float64_type
RTPS_DllAPI DynamicType_ptr create_float64_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int32_type
RTPS_DllAPI DynamicType_ptr create_int32_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int64_type
RTPS_DllAPI DynamicType_ptr create_int64_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_alias_type_code
void build_alias_type_code(const TypeDescriptor *descriptor, TypeObject &object, bool complete=true) const
eprosima::fastrtps::types::ReturnCode_t
Definition: TypesBase.h:204
eprosima::fastrtps::types::DynamicTypeBuilderFactory::delete_type
RTPS_DllAPI ReturnCode_t delete_type(DynamicType *type)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint16_type
RTPS_DllAPI DynamicType_ptr create_uint16_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::get_primitive_type
RTPS_DllAPI DynamicType_ptr get_primitive_type(TypeKind kind)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_struct_builder
RTPS_DllAPI DynamicTypeBuilder * create_struct_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_union_builder
RTPS_DllAPI DynamicTypeBuilder * create_union_builder(DynamicType_ptr discriminator_type)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::delete_instance
static RTPS_DllAPI ReturnCode_t delete_instance()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_bitmask_builder
RTPS_DllAPI DynamicTypeBuilder * create_bitmask_builder(uint32_t bound)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_char16_builder
RTPS_DllAPI DynamicTypeBuilder * create_char16_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::get_instance
static RTPS_DllAPI DynamicTypeBuilderFactory * get_instance()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_type_object
RTPS_DllAPI void build_type_object(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > *members=nullptr, bool complete=true, bool force=false) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_builder_copy
RTPS_DllAPI DynamicTypeBuilder * create_builder_copy(const DynamicTypeBuilder *type)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_type_identifier
RTPS_DllAPI void build_type_identifier(const TypeDescriptor *descriptor, TypeIdentifier &identifier, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int32_builder
RTPS_DllAPI DynamicTypeBuilder * create_int32_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_bool_builder
RTPS_DllAPI DynamicTypeBuilder * create_bool_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_map_type_code
void build_map_type_code(const TypeDescriptor *descriptor, TypeObject &object, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_bitset_type
RTPS_DllAPI DynamicType_ptr create_bitset_type(uint32_t bound)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::DynamicTypeBuilderFactory
DynamicTypeBuilderFactory()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_uint64_type
RTPS_DllAPI DynamicType_ptr create_uint64_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_alias_type
RTPS_DllAPI DynamicType_ptr create_alias_type(DynamicTypeBuilder *base_type, const std::string &sName)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_annotation_primitive
RTPS_DllAPI DynamicType_ptr create_annotation_primitive(const std::string &name)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_alias_builder
RTPS_DllAPI DynamicTypeBuilder * create_alias_builder(DynamicTypeBuilder *base_type, const std::string &sName)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float32_type
RTPS_DllAPI DynamicType_ptr create_float32_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_char8_type
RTPS_DllAPI DynamicType_ptr create_char8_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_string16_type_code
void build_string16_type_code(const TypeDescriptor *descriptor) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::set_annotation_default_value
void set_annotation_default_value(AnnotationParameterValue &apv, const MemberDescriptor *member) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_bitset_builder
RTPS_DllAPI DynamicTypeBuilder * create_bitset_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_string_builder
RTPS_DllAPI DynamicTypeBuilder * create_string_builder(uint32_t bound=MAX_STRING_LENGTH)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_string8_type_code
void build_string8_type_code(const TypeDescriptor *descriptor) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory
Definition: DynamicTypeBuilderFactory.h:40
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_bool_type
RTPS_DllAPI DynamicType_ptr create_bool_type()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int16_builder
RTPS_DllAPI DynamicTypeBuilder * create_int16_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_enum_type_code
void build_enum_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_union_type_code
void build_union_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_type
DynamicType_ptr build_type(DynamicType_ptr other)
eprosima::fastrtps::types::MAX_ELEMENTS_COUNT
const int32_t MAX_ELEMENTS_COUNT
Definition: TypesBase.h:277
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float64_builder
RTPS_DllAPI DynamicTypeBuilder * create_float64_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_map_builder
RTPS_DllAPI DynamicTypeBuilder * create_map_builder(DynamicType_ptr key_type, DynamicType_ptr value_type, uint32_t bound=MAX_ELEMENTS_COUNT)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float128_builder
RTPS_DllAPI DynamicTypeBuilder * create_float128_builder()
eprosima::fastrtps::types::TypeObject
Definition: TypeObject.h:4429
eprosima::fastrtps::types::DynamicTypeBuilderFactory::delete_builder
RTPS_DllAPI ReturnCode_t delete_builder(DynamicTypeBuilder *builder)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_alias_builder
RTPS_DllAPI DynamicTypeBuilder * create_alias_builder(DynamicType_ptr base_type, const std::string &sName)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_wstring_builder
RTPS_DllAPI DynamicTypeBuilder * create_wstring_builder(uint32_t bound=MAX_STRING_LENGTH)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_byte_builder
RTPS_DllAPI DynamicTypeBuilder * create_byte_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::build_bitmask_type_code
void build_bitmask_type_code(const TypeDescriptor *descriptor, TypeObject &object, const std::vector< const MemberDescriptor * > members, bool complete=true) const
eprosima::fastrtps::types::DynamicTypeBuilderFactory::is_empty
RTPS_DllAPI bool is_empty() const
eprosima::fastrtps::types::DynamicType_ptr
Definition: DynamicTypePtr.h:27
eprosima
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_float32_builder
RTPS_DllAPI DynamicTypeBuilder * create_float32_builder()
eprosima::fastrtps::types::AppliedAnnotationSeq
std::vector< AppliedAnnotation > AppliedAnnotationSeq
Definition: AnnotationParameterValue.h:1100
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_int64_builder
RTPS_DllAPI DynamicTypeBuilder * create_int64_builder()
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_type
RTPS_DllAPI DynamicType_ptr create_type(const DynamicTypeBuilder *other)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_alias_type
RTPS_DllAPI DynamicType_ptr create_alias_type(DynamicType_ptr base_type, const std::string &sName)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_array_builder
RTPS_DllAPI DynamicTypeBuilder * create_array_builder(const DynamicTypeBuilder *element_type, const std::vector< uint32_t > &bounds)
eprosima::fastrtps::types::DynamicTypeBuilderFactory::mutex_
std::recursive_mutex mutex_
Definition: DynamicTypeBuilderFactory.h:120
eprosima::fastrtps::types::DynamicTypeBuilderFactory::create_array_builder
RTPS_DllAPI DynamicTypeBuilder * create_array_builder(const DynamicType_ptr type, const std::vector< uint32_t > &bounds)