Fast RTPS  Version 2.6.0
Fast RTPS
Loading...
Searching...
No Matches
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/AnnotationDescriptor.h>
19#include <fastrtps/types/DynamicTypePtr.h>
20#include <fastrtps/types/TypesBase.h>
21
22class MemberDescriptor;
23class DynamicType;
24
25namespace eprosima {
26namespace fastrtps {
27namespace types {
28
30{
31protected:
32
33 TypeKind kind_; // Type Kind.
34 std::string name_; // Type Name.
35 DynamicType_ptr base_type_; // SuperType of an structure or base type of an alias type.
36 DynamicType_ptr discriminator_type_; // Discrimination type for a union.
37 std::vector<uint32_t> bound_; // Length for strings, arrays, sequences, maps and bitmasks.
38 DynamicType_ptr element_type_; // Value Type for arrays, sequences, maps, bitmasks.
39 DynamicType_ptr key_element_type_; // Key Type for maps.
40 std::vector<AnnotationDescriptor*> annotation_; // Annotations to apply
41
42 void clean();
43
45 const std::string& sName);
46
48 friend class TypeObjectFactory;
49 friend class DynamicType;
50 friend class MemberDescriptor;
51 friend class DynamicDataHelper;
52
53public:
54
56
57 RTPS_DllAPI TypeDescriptor(
58 const TypeDescriptor* other);
59
60 RTPS_DllAPI TypeDescriptor(
61 const std::string& name,
62 TypeKind kind);
63
64 RTPS_DllAPI ~TypeDescriptor();
65
67 const TypeDescriptor* descriptor);
68
69 bool equals(
70 const TypeDescriptor* descriptor) const;
71
72 bool is_consistent() const;
73
75
76 uint32_t get_bounds(
77 uint32_t index = 0) const;
78
79 uint32_t get_bounds_size() const;
80
82
84
86
88
89 std::string get_name() const;
90
91 uint32_t get_total_bounds() const;
92
94 TypeKind kind);
95
97 std::string name);
98
100 AnnotationDescriptor& descriptor);
101
103 const std::string& annotation_name,
104 const std::string& key,
105 const std::string& value);
106
108 const std::string& name) const;
109
110 // Annotations application
112
114
116
118
120
122
123 bool annotation_is_key() const;
124
126
127 // Annotation getters
128 std::string annotation_get_extensibility() const;
129
131
132 uint16_t annotation_get_bit_bound() const;
133
134 bool annotation_get_key() const;
135
136 // Annotation setters
138 const std::string& extensibility);
139
141
143
145
147 bool nested);
148
150 uint16_t bit_bound);
151
153 bool key);
154
156 bool non_serialized);
157};
158
159} // namespace types
160} // namespace fastrtps
161} // namespace eprosima
162
163#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:30
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:34
AnnotationDescriptor * get_annotation(const std::string &name) const
static bool is_type_name_consistent(const std::string &sName)
DynamicType_ptr discriminator_type_
Definition: TypeDescriptor.h:36
uint32_t get_bounds(uint32_t index=0) const
DynamicType_ptr get_key_element_type() const
DynamicType_ptr key_element_type_
Definition: TypeDescriptor.h:39
TypeKind kind_
Definition: TypeDescriptor.h:33
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:35
std::string annotation_get_extensibility() const
std::vector< uint32_t > bound_
Definition: TypeDescriptor.h:37
void annotation_set_non_serialized(bool non_serialized)
DynamicType_ptr get_element_type() const
std::vector< AnnotationDescriptor * > annotation_
Definition: TypeDescriptor.h:40
DynamicType_ptr element_type_
Definition: TypeDescriptor.h:38
Definition: TypeObjectFactory.h:29
octet TypeKind
Definition: TypesBase.h:119
eProsima namespace.
Definition: LibrarySettingsAttributes.h:23
Definition: BuiltinAnnotationsTypeObject.h:73