1818#include < fastrtps/types/TypesBase.h>
1919#include < fastrtps/types/DynamicTypePtr.h>
2020
21- namespace eprosima {
22- namespace fastrtps {
23- namespace types {
21+ namespace eprosima {
22+ namespace fastrtps {
23+ namespace types {
2424
2525class DynamicType ;
2626class AnnotationDescriptor ;
2727
2828class MemberDescriptor
2929{
3030protected:
31+
3132 std::string name_; // Name of the member
3233 MemberId id_; // MemberId, it should be filled automatically when the member is added.
3334 DynamicType_ptr type_; // Member's Type.
@@ -43,11 +44,17 @@ class MemberDescriptor
4344 friend class DynamicTypeMember ;
4445 friend class TypeObjectFactory ;
4546
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 ;
4752
48- bool is_type_name_consistent (const std::string& sName ) const ;
53+ void copy_annotations_from_type (
54+ const DynamicType_ptr& type);
4955
5056public:
57+
5158 RTPS_DllAPI MemberDescriptor ();
5259
5360 RTPS_DllAPI MemberDescriptor (
@@ -57,37 +64,41 @@ class MemberDescriptor
5764 RTPS_DllAPI MemberDescriptor (
5865 MemberId id,
5966 const std::string& name,
60- DynamicType_ptr type_ );
67+ DynamicType_ptr type );
6168
6269 RTPS_DllAPI MemberDescriptor (
6370 MemberId id,
6471 const std::string& name,
65- DynamicType_ptr type_ ,
72+ DynamicType_ptr type ,
6673 const std::string& defaultValue);
6774
6875 RTPS_DllAPI MemberDescriptor (
6976 MemberId id,
7077 const std::string& name,
71- DynamicType_ptr type_ ,
78+ DynamicType_ptr type ,
7279 const std::string& defaultValue,
7380 const std::vector<uint64_t >& unionLabels,
7481 bool isDefaultLabel);
7582
76- RTPS_DllAPI MemberDescriptor (const MemberDescriptor* descriptor);
83+ RTPS_DllAPI MemberDescriptor (
84+ const MemberDescriptor* descriptor);
7785
7886 RTPS_DllAPI ~MemberDescriptor ();
7987
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 ;
8190
82- RTPS_DllAPI ReturnCode_t copy_from (const MemberDescriptor* other);
91+ RTPS_DllAPI ReturnCode_t copy_from (
92+ const MemberDescriptor* other);
8393
84- RTPS_DllAPI bool equals (const MemberDescriptor* other) const ;
94+ RTPS_DllAPI bool equals (
95+ const MemberDescriptor* other) const ;
8596
8697 RTPS_DllAPI TypeKind get_kind () const ;
8798
8899 RTPS_DllAPI MemberId get_id () const ;
89100
90- RTPS_DllAPI uint32_t get_index () const ;
101+ RTPS_DllAPI uint32_t get_index () const ;
91102
92103 RTPS_DllAPI std::string get_name () const ;
93104
@@ -105,39 +116,49 @@ class MemberDescriptor
105116
106117 RTPS_DllAPI bool is_default_union_value () const ;
107118
108- RTPS_DllAPI bool is_consistent (TypeKind parentKind) const ;
119+ RTPS_DllAPI bool is_consistent (
120+ TypeKind parentKind) const ;
109121
110- RTPS_DllAPI void add_union_case_index (uint64_t value);
122+ RTPS_DllAPI void add_union_case_index (
123+ uint64_t value);
111124
112- RTPS_DllAPI void set_id (MemberId id);
125+ RTPS_DllAPI void set_id (
126+ MemberId id);
113127
114- RTPS_DllAPI void set_index (uint32_t index);
128+ RTPS_DllAPI void set_index (
129+ uint32_t index);
115130
116- RTPS_DllAPI void set_name (const std::string& name);
131+ RTPS_DllAPI void set_name (
132+ const std::string& name);
117133
118- RTPS_DllAPI void set_type (DynamicType_ptr type);
134+ RTPS_DllAPI void set_type (
135+ DynamicType_ptr type);
119136
120137 RTPS_DllAPI DynamicType_ptr get_type () const
121138 {
122139 return type_;
123140 }
124141
125- RTPS_DllAPI void set_default_union_value (bool bDefault);
142+ RTPS_DllAPI void set_default_union_value (
143+ bool bDefault);
126144
127- RTPS_DllAPI void set_default_value (const std::string& value)
145+ RTPS_DllAPI void set_default_value (
146+ const std::string& value)
128147 {
129148 default_value_ = value;
130149 }
131150
132151 // Annotations
133- ReturnCode_t apply_annotation (AnnotationDescriptor& descriptor);
152+ ReturnCode_t apply_annotation (
153+ AnnotationDescriptor& descriptor);
134154
135155 ReturnCode_t apply_annotation (
136156 const std::string& annotation_name,
137157 const std::string& key,
138158 const std::string& value);
139159
140- AnnotationDescriptor* get_annotation (const std::string& name) const ;
160+ AnnotationDescriptor* get_annotation (
161+ const std::string& name) const ;
141162
142163 // Annotations application
143164 RTPS_DllAPI bool annotation_is_optional () const ;
@@ -168,23 +189,31 @@ class MemberDescriptor
168189 RTPS_DllAPI uint16_t annotation_get_bit_bound () const ;
169190
170191 // Annotations setters
171- RTPS_DllAPI void annotation_set_optional (bool optional);
192+ RTPS_DllAPI void annotation_set_optional (
193+ bool optional);
172194
173- RTPS_DllAPI void annotation_set_key (bool key);
195+ RTPS_DllAPI void annotation_set_key (
196+ bool key);
174197
175- RTPS_DllAPI void annotation_set_must_understand (bool must_understand);
198+ RTPS_DllAPI void annotation_set_must_understand (
199+ bool must_understand);
176200
177- RTPS_DllAPI void annotation_set_non_serialized (bool non_serialized);
201+ RTPS_DllAPI void annotation_set_non_serialized (
202+ bool non_serialized);
178203
179- RTPS_DllAPI void annotation_set_value (const std::string& value);
204+ RTPS_DllAPI void annotation_set_value (
205+ const std::string& value);
180206
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);
182209
183210 RTPS_DllAPI void annotation_set_default_literal ();
184211
185- RTPS_DllAPI void annotation_set_position (uint16_t position);
212+ RTPS_DllAPI void annotation_set_position (
213+ uint16_t position);
186214
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);
188217};
189218
190219} // namespace types
0 commit comments