18
18
#include < fastrtps/types/TypesBase.h>
19
19
#include < fastrtps/types/DynamicTypePtr.h>
20
20
21
- namespace eprosima {
22
- namespace fastrtps {
23
- namespace types {
21
+ namespace eprosima {
22
+ namespace fastrtps {
23
+ namespace types {
24
24
25
25
class DynamicType ;
26
26
class AnnotationDescriptor ;
27
27
28
28
class MemberDescriptor
29
29
{
30
30
protected:
31
+
31
32
std::string name_; // Name of the member
32
33
MemberId id_; // MemberId, it should be filled automatically when the member is added.
33
34
DynamicType_ptr type_; // Member's Type.
@@ -43,11 +44,17 @@ class MemberDescriptor
43
44
friend class DynamicTypeMember ;
44
45
friend class TypeObjectFactory ;
45
46
46
- bool is_default_value_consistent (const std::string& sDefaultValue ) const ;
47
+ bool is_default_value_consistent (
48
+ const std::string& sDefaultValue ) const ;
49
+
50
+ bool is_type_name_consistent (
51
+ const std::string& sName ) const ;
47
52
48
- bool is_type_name_consistent (const std::string& sName ) const ;
53
+ void copy_annotations_from_type (
54
+ const DynamicType_ptr& type);
49
55
50
56
public:
57
+
51
58
RTPS_DllAPI MemberDescriptor ();
52
59
53
60
RTPS_DllAPI MemberDescriptor (
@@ -57,37 +64,41 @@ class MemberDescriptor
57
64
RTPS_DllAPI MemberDescriptor (
58
65
MemberId id,
59
66
const std::string& name,
60
- DynamicType_ptr type_ );
67
+ DynamicType_ptr type );
61
68
62
69
RTPS_DllAPI MemberDescriptor (
63
70
MemberId id,
64
71
const std::string& name,
65
- DynamicType_ptr type_ ,
72
+ DynamicType_ptr type ,
66
73
const std::string& defaultValue);
67
74
68
75
RTPS_DllAPI MemberDescriptor (
69
76
MemberId id,
70
77
const std::string& name,
71
- DynamicType_ptr type_ ,
78
+ DynamicType_ptr type ,
72
79
const std::string& defaultValue,
73
80
const std::vector<uint64_t >& unionLabels,
74
81
bool isDefaultLabel);
75
82
76
- RTPS_DllAPI MemberDescriptor (const MemberDescriptor* descriptor);
83
+ RTPS_DllAPI MemberDescriptor (
84
+ const MemberDescriptor* descriptor);
77
85
78
86
RTPS_DllAPI ~MemberDescriptor ();
79
87
80
- bool check_union_labels (const std::vector<uint64_t >& labels) const ;
88
+ bool check_union_labels (
89
+ const std::vector<uint64_t >& labels) const ;
81
90
82
- RTPS_DllAPI ReturnCode_t copy_from (const MemberDescriptor* other);
91
+ RTPS_DllAPI ReturnCode_t copy_from (
92
+ const MemberDescriptor* other);
83
93
84
- RTPS_DllAPI bool equals (const MemberDescriptor* other) const ;
94
+ RTPS_DllAPI bool equals (
95
+ const MemberDescriptor* other) const ;
85
96
86
97
RTPS_DllAPI TypeKind get_kind () const ;
87
98
88
99
RTPS_DllAPI MemberId get_id () const ;
89
100
90
- RTPS_DllAPI uint32_t get_index () const ;
101
+ RTPS_DllAPI uint32_t get_index () const ;
91
102
92
103
RTPS_DllAPI std::string get_name () const ;
93
104
@@ -105,39 +116,49 @@ class MemberDescriptor
105
116
106
117
RTPS_DllAPI bool is_default_union_value () const ;
107
118
108
- RTPS_DllAPI bool is_consistent (TypeKind parentKind) const ;
119
+ RTPS_DllAPI bool is_consistent (
120
+ TypeKind parentKind) const ;
109
121
110
- RTPS_DllAPI void add_union_case_index (uint64_t value);
122
+ RTPS_DllAPI void add_union_case_index (
123
+ uint64_t value);
111
124
112
- RTPS_DllAPI void set_id (MemberId id);
125
+ RTPS_DllAPI void set_id (
126
+ MemberId id);
113
127
114
- RTPS_DllAPI void set_index (uint32_t index);
128
+ RTPS_DllAPI void set_index (
129
+ uint32_t index);
115
130
116
- RTPS_DllAPI void set_name (const std::string& name);
131
+ RTPS_DllAPI void set_name (
132
+ const std::string& name);
117
133
118
- RTPS_DllAPI void set_type (DynamicType_ptr type);
134
+ RTPS_DllAPI void set_type (
135
+ DynamicType_ptr type);
119
136
120
137
RTPS_DllAPI DynamicType_ptr get_type () const
121
138
{
122
139
return type_;
123
140
}
124
141
125
- RTPS_DllAPI void set_default_union_value (bool bDefault);
142
+ RTPS_DllAPI void set_default_union_value (
143
+ bool bDefault);
126
144
127
- RTPS_DllAPI void set_default_value (const std::string& value)
145
+ RTPS_DllAPI void set_default_value (
146
+ const std::string& value)
128
147
{
129
148
default_value_ = value;
130
149
}
131
150
132
151
// Annotations
133
- ReturnCode_t apply_annotation (AnnotationDescriptor& descriptor);
152
+ ReturnCode_t apply_annotation (
153
+ AnnotationDescriptor& descriptor);
134
154
135
155
ReturnCode_t apply_annotation (
136
156
const std::string& annotation_name,
137
157
const std::string& key,
138
158
const std::string& value);
139
159
140
- AnnotationDescriptor* get_annotation (const std::string& name) const ;
160
+ AnnotationDescriptor* get_annotation (
161
+ const std::string& name) const ;
141
162
142
163
// Annotations application
143
164
RTPS_DllAPI bool annotation_is_optional () const ;
@@ -168,23 +189,31 @@ class MemberDescriptor
168
189
RTPS_DllAPI uint16_t annotation_get_bit_bound () const ;
169
190
170
191
// Annotations setters
171
- RTPS_DllAPI void annotation_set_optional (bool optional);
192
+ RTPS_DllAPI void annotation_set_optional (
193
+ bool optional);
172
194
173
- RTPS_DllAPI void annotation_set_key (bool key);
195
+ RTPS_DllAPI void annotation_set_key (
196
+ bool key);
174
197
175
- RTPS_DllAPI void annotation_set_must_understand (bool must_understand);
198
+ RTPS_DllAPI void annotation_set_must_understand (
199
+ bool must_understand);
176
200
177
- RTPS_DllAPI void annotation_set_non_serialized (bool non_serialized);
201
+ RTPS_DllAPI void annotation_set_non_serialized (
202
+ bool non_serialized);
178
203
179
- RTPS_DllAPI void annotation_set_value (const std::string& value);
204
+ RTPS_DllAPI void annotation_set_value (
205
+ const std::string& value);
180
206
181
- RTPS_DllAPI void annotation_set_default (const std::string& default_value);
207
+ RTPS_DllAPI void annotation_set_default (
208
+ const std::string& default_value);
182
209
183
210
RTPS_DllAPI void annotation_set_default_literal ();
184
211
185
- RTPS_DllAPI void annotation_set_position (uint16_t position);
212
+ RTPS_DllAPI void annotation_set_position (
213
+ uint16_t position);
186
214
187
- RTPS_DllAPI void annotation_set_bit_bound (uint16_t bit_bound);
215
+ RTPS_DllAPI void annotation_set_bit_bound (
216
+ uint16_t bit_bound);
188
217
};
189
218
190
219
} // namespace types
0 commit comments