Fast DDS  Version 3.6.1.0
Fast DDS
MemberDescriptor.hpp
1 // Copyright 2023 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 FASTDDS_DDS_XTYPES_DYNAMIC_TYPES__MEMBERDESCRIPTOR_HPP
16 #define FASTDDS_DDS_XTYPES_DYNAMIC_TYPES__MEMBERDESCRIPTOR_HPP
17 
18 #include <cstdint>
19 #include <string>
20 #include <vector>
21 
22 #include <fastdds/dds/core/ReturnCode.hpp>
23 #include <fastdds/dds/xtypes/dynamic_types/Types.hpp>
24 #include <fastdds/fastdds_dll.hpp>
25 
26 namespace eprosima {
27 namespace fastdds {
28 namespace dds {
29 
30 class DynamicType;
31 
32 class FASTDDS_EXPORTED_API MemberDescriptor
33 {
34 public:
35 
37 
42  virtual ObjectName& name() = 0;
43 
48  virtual const ObjectName& name() const = 0;
49 
54  virtual void name(
55  const ObjectName& name) = 0;
56 
61  virtual void name(
62  ObjectName&& name) = 0;
63 
68  virtual MemberId id() const = 0;
69 
74  virtual MemberId& id() = 0;
75 
80  virtual void id(
81  MemberId id) = 0;
82 
88  virtual MemberId position() const = 0;
89 
95  virtual MemberId& position() = 0;
96 
102  virtual void position(
103  MemberId position) = 0;
104 
109  virtual traits<DynamicType>::ref_type type() const = 0;
110 
116 
121  virtual void type(
123 
128  virtual std::string& default_value() = 0;
129 
134  virtual const std::string& default_value() const = 0;
135 
140  virtual void default_value(
141  const std::string& default_value) = 0;
142 
147  virtual void default_value(
148  std::string&& default_value) = 0;
149 
156  virtual std::string& literal_value() = 0;
157 
164  virtual const std::string& literal_value() const = 0;
165 
171  virtual void literal_value(
172  const std::string& literal_value) = 0;
173 
178  virtual uint32_t& index() = 0;
179 
184  virtual uint32_t index() const = 0;
185 
190  virtual const UnionCaseLabelSeq& label() const = 0;
191 
196  virtual UnionCaseLabelSeq& label() = 0;
197 
202  virtual void label(
203  const UnionCaseLabelSeq& label) = 0;
204 
209  virtual void label(
210  UnionCaseLabelSeq&& label) = 0;
211 
217 
223 
228  virtual void try_construct_kind(
229  TryConstructKind try_construct_kind) = 0;
230 
235  virtual bool is_key() const = 0;
236 
241  virtual bool& is_key() = 0;
242 
247  virtual void is_key(
248  bool is_key) = 0;
249 
254  virtual bool is_optional() const = 0;
255 
260  virtual bool& is_optional() = 0;
261 
266  virtual void is_optional(
267  bool is_optional) = 0;
268 
273  virtual bool is_must_understand() const = 0;
274 
279  virtual bool& is_must_understand() = 0;
280 
285  virtual void is_must_understand(
286  bool is_must_understand) = 0;
287 
292  virtual bool is_shared() const = 0;
293 
298  virtual bool& is_shared() = 0;
299 
304  virtual void is_shared(
305  bool is_shared) = 0;
306 
311  virtual bool is_default_label() const = 0;
312 
317  virtual bool& is_default_label() = 0;
318 
323  virtual void is_default_label(
324  bool is_default_label) = 0;
325 
330  virtual bool is_default_literal() const = 0;
331 
336  virtual bool& is_default_literal() = 0;
337 
342  virtual void is_default_literal(
343  bool is_default_literal) = 0;
344 
353  traits<MemberDescriptor>::ref_type descriptor) = 0;
354 
360  virtual bool equals(
361  traits<MemberDescriptor>::ref_type descriptor) = 0;
362 
368  virtual bool is_consistent() = 0;
369 
370 protected:
371 
372  MemberDescriptor() = default;
373 
375  const MemberDescriptor& type) = default;
376 
378  MemberDescriptor&& type) = default;
379 
380  virtual ~MemberDescriptor() = default;
381 
382 private:
383 
384  MemberDescriptor& operator =(
385  const MemberDescriptor& type) = delete;
386 
387  MemberDescriptor& operator =(
388  MemberDescriptor&& type) = delete;
389 
390 };
391 
392 } // namespace dds
393 } // namespace fastdds
394 } // namespace eprosima
395 
396 #endif // FASTDDS_DDS_XTYPES_DYNAMIC_TYPES__MEMBERDESCRIPTOR_HPP
Definition: MemberDescriptor.hpp:33
virtual TryConstructKind & try_construct_kind()=0
Returns the TryConstructKind of the member.
virtual void label(UnionCaseLabelSeq &&label)=0
Modifies the labels the member belongs to by move.
virtual void position(MemberId position)=0
Modifies the position of the bitmask member.
virtual bool is_consistent()=0
Indicates whether the states of all of this descriptor's properties are consistent according with the...
MemberDescriptor(const MemberDescriptor &type)=default
virtual bool is_optional() const =0
Returns the if the member is optional.
virtual void name(ObjectName &&name)=0
Modifies the underlying member's name by move.
virtual bool is_key() const =0
Returns the if the member is key.
typename traits< MemberDescriptor >::ref_type _ref_type
Definition: MemberDescriptor.hpp:36
virtual MemberId & id()=0
Returns the MemberId of the member.
virtual std::string & default_value()=0
Returns the default value.
virtual ReturnCode_t copy_from(traits< MemberDescriptor >::ref_type descriptor)=0
Overwrites the contents of this descriptor with those of another descriptor (see [standard] 7....
virtual MemberId id() const =0
Returns the MemberId of the member.
virtual uint32_t index() const =0
Returns the order of definition of the member.
virtual MemberId position() const =0
Returns the position of the bitmask member.
virtual void try_construct_kind(TryConstructKind try_construct_kind)=0
Modifies the TryConstructKind of the member.
virtual void is_default_literal(bool is_default_literal)=0
Modifies if the member is a default literal.
virtual traits< DynamicType >::ref_type type() const =0
Returns a reference to the member's type.
virtual void is_shared(bool is_shared)=0
Modifies if the member is shared.
virtual void name(const ObjectName &name)=0
Modifies the underlying member's name by copy.
virtual const std::string & default_value() const =0
Returns the default value.
virtual MemberId & position()=0
Returns the position of the bitmask member.
virtual void default_value(const std::string &default_value)=0
Modifies the underlying default value by copy.
virtual void literal_value(const std::string &literal_value)=0
Modifies the underlying literal value by copy.
MemberDescriptor(MemberDescriptor &&type)=default
virtual bool & is_optional()=0
Returns the if the member is optional.
virtual std::string & literal_value()=0
Returns the assigned value for members representing an enumerated literal.
virtual UnionCaseLabelSeq & label()=0
Returns the labels the member belongs to.
virtual TryConstructKind try_construct_kind() const =0
Returns the TryConstructKind of the member.
virtual bool & is_default_label()=0
Returns the if the member is default_label.
virtual uint32_t & index()=0
Returns the order of definition of the member.
virtual bool is_must_understand() const =0
Returns the if the member is must_understand.
virtual bool & is_shared()=0
Returns the if the member is shared.
virtual void label(const UnionCaseLabelSeq &label)=0
Modifies the labels the member belongs to by copy.
virtual const UnionCaseLabelSeq & label() const =0
Returns the labels the member belongs to.
virtual void is_optional(bool is_optional)=0
Modifies if the member is optional.
virtual bool & is_must_understand()=0
Returns the if the member is must_understand.
virtual bool is_default_label() const =0
Returns the if the member is default_label.
virtual void is_key(bool is_key)=0
Modifies if the member is key.
virtual bool & is_default_literal()=0
Returns if the member is a default literal.
virtual void is_default_label(bool is_default_label)=0
Modifies if the member is default_label.
virtual const ObjectName & name() const =0
Returns the name of this member.
virtual void default_value(std::string &&default_value)=0
Modifies the underlying default value by move.
virtual traits< DynamicType >::ref_type & type()=0
Returns a reference to the member's type.
virtual const std::string & literal_value() const =0
Returns the assigned value for members representing an enumerated literal.
virtual void id(MemberId id)=0
Modifies the underlying MemberId.
virtual bool is_shared() const =0
Returns the if the member is shared.
virtual bool equals(traits< MemberDescriptor >::ref_type descriptor)=0
Compares according with the [standard] section 7.5.2.7.4.
virtual void type(traits< DynamicType >::ref_type type)=0
Modifies the underlying member's type reference.
virtual ObjectName & name()=0
Returns the name of this member.
virtual bool is_default_literal() const =0
Returns if the member is a default literal.
virtual void is_must_understand(bool is_must_understand)=0
Modifies if the member is must_understand.
virtual bool & is_key()=0
Returns the if the member is key.
TryConstructKind
This class represents the enumeration TryConstructKind defined by the user in the IDL file.
Definition: dynamic_language_binding.hpp:117
Definition: DomainParticipant.hpp:46
uint32_t MemberId
Definition: dynamic_language_binding.hpp:122
std::vector< int32_t > UnionCaseLabelSeq
Definition: dynamic_language_binding.hpp:124
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
eprosima::fastcdr::fixed_string< 256 > ObjectName
Definition: dynamic_language_binding.hpp:66
typename ::std::shared_ptr< T > ref_type
Definition: type_traits.hpp:29