Fast DDS  Version 3.6.1.0
Fast DDS
DynamicTypeBuilder.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__DYNAMICTYPEBUILDER_HPP
16 #define FASTDDS_DDS_XTYPES_DYNAMIC_TYPES__DYNAMICTYPEBUILDER_HPP
17 
18 #include <memory>
19 
20 #include <fastdds/dds/core/ReturnCode.hpp>
21 #include <fastdds/dds/xtypes/dynamic_types/AnnotationDescriptor.hpp>
22 #include <fastdds/dds/xtypes/dynamic_types/DynamicTypeMember.hpp>
23 #include <fastdds/dds/xtypes/dynamic_types/TypeDescriptor.hpp>
24 #include <fastdds/dds/xtypes/dynamic_types/Types.hpp>
25 #include <fastdds/fastdds_dll.hpp>
26 
27 namespace eprosima {
28 namespace fastdds {
29 namespace dds {
30 
31 class DynamicTypeBuilder : public std::enable_shared_from_this<DynamicTypeBuilder>
32 {
33 public:
34 
36 
44  FASTDDS_EXPORTED_API virtual ReturnCode_t get_descriptor(
45  traits<TypeDescriptor>::ref_type& descriptor) = 0;
46 
51  FASTDDS_EXPORTED_API virtual ObjectName get_name() = 0;
52 
57  FASTDDS_EXPORTED_API virtual TypeKind get_kind() = 0;
58 
67  FASTDDS_EXPORTED_API virtual ReturnCode_t get_member_by_name(
69  const ObjectName& name) = 0;
70 
77  FASTDDS_EXPORTED_API virtual ReturnCode_t get_all_members_by_name(
78  DynamicTypeMembersByName& member) = 0;
87  FASTDDS_EXPORTED_API virtual ReturnCode_t get_member(
89  MemberId id) = 0;
90 
97  FASTDDS_EXPORTED_API virtual ReturnCode_t get_all_members(
98  DynamicTypeMembersById& member) = 0;
99 
104  FASTDDS_EXPORTED_API virtual uint32_t get_member_count() = 0;
105 
114  FASTDDS_EXPORTED_API virtual ReturnCode_t get_member_by_index(
116  uint32_t index) = 0;
117 
122  FASTDDS_EXPORTED_API virtual uint32_t get_annotation_count() = 0;
123 
132  FASTDDS_EXPORTED_API virtual ReturnCode_t get_annotation(
134  uint32_t idx) = 0;
135 
141  FASTDDS_EXPORTED_API virtual bool equals(
143 
153  FASTDDS_EXPORTED_API virtual ReturnCode_t add_member(
154  traits<MemberDescriptor>::ref_type descriptor) = 0;
155 
163  FASTDDS_EXPORTED_API virtual ReturnCode_t apply_annotation(
165 
174  FASTDDS_EXPORTED_API virtual ReturnCode_t apply_annotation_to_member(
175  MemberId member_id,
177 
182  FASTDDS_EXPORTED_API virtual traits<DynamicType>::ref_type build() = 0;
183 
184 protected:
185 
186  DynamicTypeBuilder() = default;
187 
188  virtual ~DynamicTypeBuilder() = default;
189 
191 
192 private:
193 
195  const DynamicTypeBuilder&) = delete;
196 
198  DynamicTypeBuilder&&) = delete;
199 
200  DynamicTypeBuilder& operator =(
201  const DynamicTypeBuilder&) = delete;
202 
203  DynamicTypeBuilder& operator =(
204  DynamicTypeBuilder&&) = delete;
205 };
206 
207 } // namespace dds
208 } // namespace fastdds
209 } // namespace eprosima
210 
211 #endif // FASTDDS_DDS_XTYPES_DYNAMIC_TYPES__DYNAMICTYPEBUILDER_HPP
Definition: DynamicTypeBuilder.hpp:32
traits< DynamicTypeBuilder >::ref_type _this()
typename traits< DynamicTypeBuilder >::ref_type _ref_type
Definition: DynamicTypeBuilder.hpp:35
virtual FASTDDS_EXPORTED_API ReturnCode_t get_member(traits< DynamicTypeMember >::ref_type &member, MemberId id)=0
Returns a member looked for by MemberId.
virtual FASTDDS_EXPORTED_API ReturnCode_t add_member(traits< MemberDescriptor >::ref_type descriptor)=0
Adds a 'member' to this type, where the new 'member' has the meaning defined in the specification of ...
virtual FASTDDS_EXPORTED_API ReturnCode_t apply_annotation_to_member(MemberId member_id, traits< AnnotationDescriptor >::ref_type descriptor)=0
Apply the given annotation to a member of this type.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_member_by_name(traits< DynamicTypeMember >::ref_type &member, const ObjectName &name)=0
Returns a member looked for by name.
virtual FASTDDS_EXPORTED_API traits< DynamicType >::ref_type build()=0
Create an immutable DynamicType object containing a snapshot of this builder's current state.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_all_members_by_name(DynamicTypeMembersByName &member)=0
Returns all members sorted by name.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_member_by_index(traits< DynamicTypeMember >::ref_type &member, uint32_t index)=0
This operation returns the member that corresponds to the specified index.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_descriptor(traits< TypeDescriptor >::ref_type &descriptor)=0
Provides a summary of the state of this type overwriting a provided object.
virtual FASTDDS_EXPORTED_API TypeKind get_kind()=0
Returns the TypeKind associated.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_annotation(traits< AnnotationDescriptor >::ref_type &descriptor, uint32_t idx)=0
This operation returns the annotation that corresponds to the specified index.
virtual FASTDDS_EXPORTED_API ReturnCode_t get_all_members(DynamicTypeMembersById &member)=0
Returns all members sorted by MemberId.
virtual FASTDDS_EXPORTED_API uint32_t get_member_count()=0
This operation returns the current number of members.
virtual FASTDDS_EXPORTED_API ObjectName get_name()=0
Returns the fully qualified name of this type.
virtual FASTDDS_EXPORTED_API uint32_t get_annotation_count()=0
This operation returns the current number of annotations to the type.
virtual FASTDDS_EXPORTED_API ReturnCode_t apply_annotation(traits< AnnotationDescriptor >::ref_type descriptor)=0
Apply the given annotation to this type.
virtual FASTDDS_EXPORTED_API bool equals(traits< DynamicType >::ref_type other)=0
Compares current state against a DynamicType reference.
Definition: DomainParticipant.hpp:46
uint32_t MemberId
Definition: dynamic_language_binding.hpp:122
std::map< MemberId, traits< DynamicTypeMember >::ref_type > DynamicTypeMembersById
Definition: DynamicTypeMember.hpp:133
int32_t ReturnCode_t
Definition: DDSReturnCode.hpp:59
eprosima::fastcdr::fixed_string< 256 > ObjectName
Definition: dynamic_language_binding.hpp:66
std::map< ObjectName, traits< DynamicTypeMember >::ref_type > DynamicTypeMembersByName
Definition: DynamicTypeMember.hpp:131
uint8_t TypeKind
Definition: dynamic_language_binding.hpp:70
typename ::std::shared_ptr< T > ref_type
Definition: type_traits.hpp:29