Fast RTPS  Version 2.4.1
Fast RTPS
TypeDescriptor.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_TYPE_DESCRIPTOR_H
16 #define TYPES_TYPE_DESCRIPTOR_H
17 
18 #include <fastrtps/types/TypesBase.h>
19 #include <fastrtps/types/DynamicTypePtr.h>
20 
21 class MemberDescriptor;
22 class DynamicType;
23 
24 namespace eprosima {
25 namespace fastrtps {
26 namespace types {
27 
29 {
30 protected:
31 
32  TypeKind kind_; // Type Kind.
33  std::string name_; // Type Name.
34  DynamicType_ptr base_type_; // SuperType of an structure or base type of an alias type.
35  DynamicType_ptr discriminator_type_; // Discrimination type for a union.
36  std::vector<uint32_t> bound_; // Length for strings, arrays, sequences, maps and bitmasks.
37  DynamicType_ptr element_type_; // Value Type for arrays, sequences, maps, bitmasks.
38  DynamicType_ptr key_element_type_; // Key Type for maps.
39  std::vector<AnnotationDescriptor*> annotation_; // Annotations to apply
40 
41  void clean();
42 
44  const std::string& sName) const;
45 
47  friend class TypeObjectFactory;
48  friend class DynamicType;
49  friend class MemberDescriptor;
50  friend class DynamicDataHelper;
51 
52 public:
53 
55 
56  RTPS_DllAPI TypeDescriptor(
57  const TypeDescriptor* other);
58 
59  RTPS_DllAPI TypeDescriptor(
60  const std::string& name,
61  TypeKind kind);
62 
63  RTPS_DllAPI ~TypeDescriptor();
64 
66  const TypeDescriptor* descriptor);
67 
68  bool equals(
69  const TypeDescriptor* descriptor) const;
70 
71  bool is_consistent() const;
72 
74 
75  uint32_t get_bounds(
76  uint32_t index = 0) const;
77 
78  uint32_t get_bounds_size() const;
79 
81 
83 
85 
86  TypeKind get_kind() const;
87 
88  std::string get_name() const;
89 
90  uint32_t get_total_bounds() const;
91 
92  void set_kind(
93  TypeKind kind);
94 
95  void set_name(
96  std::string name);
97 
99  AnnotationDescriptor& descriptor);
100 
102  const std::string& annotation_name,
103  const std::string& key,
104  const std::string& value);
105 
107  const std::string& name) const;
108 
109  // Annotations application
111 
112  bool annotation_is_mutable() const;
113 
114  bool annotation_is_final() const;
115 
117 
118  bool annotation_is_nested() const;
119 
121 
122  bool annotation_is_key() const;
123 
125 
126  // Annotation getters
127  std::string annotation_get_extensibility() const;
128 
129  bool annotation_get_nested() const;
130 
131  uint16_t annotation_get_bit_bound() const;
132 
133  bool annotation_get_key() const;
134 
135  // Annotation setters
137  const std::string& extensibility);
138 
140 
142 
144 
146  bool nested);
147 
149  uint16_t bit_bound);
150 
152  bool key);
153 
155  bool non_serialized);
156 };
157 
158 } // namespace types
159 } // namespace fastrtps
160 } // namespace eprosima
161 
162 #endif // TYPES_TYPE_DESCRIPTOR_H
Definition: AnnotationDescriptor.h:29
Definition: DynamicDataHelper.hpp:30
Definition: DynamicTypePtr.h:27
Definition: DynamicTypeBuilderFactory.h:40
Definition: DynamicType.h:38
Definition: MemberDescriptor.h:29
This class represents the enumeration ReturnCode_t.
Definition: TypesBase.h:189
Definition: TypeDescriptor.h:29
DynamicType_ptr get_discriminator_type() const
void annotation_set_bit_bound(uint16_t bit_bound)
bool equals(const TypeDescriptor *descriptor) const
void annotation_set_extensibility(const std::string &extensibility)
ReturnCode_t apply_annotation(AnnotationDescriptor &descriptor)
std::string name_
Definition: TypeDescriptor.h:33
DynamicType_ptr discriminator_type_
Definition: TypeDescriptor.h:35
uint32_t get_bounds(uint32_t index=0) const
DynamicType_ptr get_key_element_type() const
bool is_type_name_consistent(const std::string &sName) const
DynamicType_ptr key_element_type_
Definition: TypeDescriptor.h:38
TypeKind kind_
Definition: TypeDescriptor.h:32
RTPS_DllAPI TypeDescriptor(const std::string &name, TypeKind kind)
ReturnCode_t apply_annotation(const std::string &annotation_name, const std::string &key, const std::string &value)
RTPS_DllAPI TypeDescriptor(const TypeDescriptor *other)
ReturnCode_t copy_from(const TypeDescriptor *descriptor)
DynamicType_ptr base_type_
Definition: TypeDescriptor.h:34
std::string annotation_get_extensibility() const
std::vector< uint32_t > bound_
Definition: TypeDescriptor.h:36
void annotation_set_non_serialized(bool non_serialized)
DynamicType_ptr get_element_type() const
std::vector< AnnotationDescriptor * > annotation_
Definition: TypeDescriptor.h:39
DynamicType_ptr element_type_
Definition: TypeDescriptor.h:37
AnnotationDescriptor * get_annotation(const std::string &name) const
Definition: TypeObjectFactory.h:29
octet TypeKind
Definition: TypesBase.h:119
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
Definition: BuiltinAnnotationsTypeObject.h:73