| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
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
35 using _ref_type = typename traits<DynamicTypeBuilder>::ref_type;
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(
68 traits<DynamicTypeMember>::ref_type& member,
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(
88 traits<DynamicTypeMember>::ref_type& 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(
115 traits<DynamicTypeMember>::ref_type& member,
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(
133 traits<AnnotationDescriptor>::ref_type& descriptor,
134 uint32_t idx) = 0;
135
141 FASTDDS_EXPORTED_API virtual bool equals(
142 traits<DynamicType>::ref_type other) = 0;
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(
164 traits<AnnotationDescriptor>::ref_type descriptor) = 0;
165
174 FASTDDS_EXPORTED_API virtual ReturnCode_t apply_annotation_to_member(
175 MemberId member_id,
176 traits<AnnotationDescriptor>::ref_type descriptor) = 0;
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
190 traits<DynamicTypeBuilder>::ref_type _this();
191
192 private:
193
194 DynamicTypeBuilder(
195 const DynamicTypeBuilder&) = delete;
196
197 DynamicTypeBuilder(
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
eprosima::fastdds::dds::DynamicTypeBuilder::_ref_type
typename traits< DynamicTypeBuilder >::ref_type _ref_type
Definition DynamicTypeBuilder.hpp:35
eprosima::fastdds::dds::DynamicTypeBuilder::get_member
virtual FASTDDS_EXPORTED_API ReturnCode_t get_member(traits< DynamicTypeMember >::ref_type &member, MemberId id)=0
Returns a member looked for by MemberId.
eprosima::fastdds::dds::DynamicTypeBuilder::add_member
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 ...
eprosima::fastdds::dds::DynamicTypeBuilder::apply_annotation_to_member
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.
eprosima::fastdds::dds::DynamicTypeBuilder::get_member_by_name
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.
eprosima::fastdds::dds::DynamicTypeBuilder::~DynamicTypeBuilder
virtual ~DynamicTypeBuilder()=default
eprosima::fastdds::dds::DynamicTypeBuilder::get_all_members_by_name
virtual FASTDDS_EXPORTED_API ReturnCode_t get_all_members_by_name(DynamicTypeMembersByName &member)=0
Returns all members sorted by name.
eprosima::fastdds::dds::DynamicTypeBuilder::build
virtual FASTDDS_EXPORTED_API traits< DynamicType >::ref_type build()=0
Create an immutable DynamicType object containing a snapshot of this builder's current state.
eprosima::fastdds::dds::DynamicTypeBuilder::get_member_by_index
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.
eprosima::fastdds::dds::DynamicTypeBuilder::get_descriptor
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.
eprosima::fastdds::dds::DynamicTypeBuilder::get_kind
virtual FASTDDS_EXPORTED_API TypeKind get_kind()=0
Returns the TypeKind associated.
eprosima::fastdds::dds::DynamicTypeBuilder::get_annotation
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.
eprosima::fastdds::dds::DynamicTypeBuilder::get_all_members
virtual FASTDDS_EXPORTED_API ReturnCode_t get_all_members(DynamicTypeMembersById &member)=0
Returns all members sorted by MemberId.
eprosima::fastdds::dds::DynamicTypeBuilder::DynamicTypeBuilder
DynamicTypeBuilder()=default
eprosima::fastdds::dds::DynamicTypeBuilder::get_member_count
virtual FASTDDS_EXPORTED_API uint32_t get_member_count()=0
This operation returns the current number of members.
eprosima::fastdds::dds::DynamicTypeBuilder::get_name
virtual FASTDDS_EXPORTED_API ObjectName get_name()=0
Returns the fully qualified name of this type.
eprosima::fastdds::dds::DynamicTypeBuilder::get_annotation_count
virtual FASTDDS_EXPORTED_API uint32_t get_annotation_count()=0
This operation returns the current number of annotations to the type.
eprosima::fastdds::dds::DynamicTypeBuilder::_this
traits< DynamicTypeBuilder >::ref_type _this()
eprosima::fastdds::dds::DynamicTypeBuilder::apply_annotation
virtual FASTDDS_EXPORTED_API ReturnCode_t apply_annotation(traits< AnnotationDescriptor >::ref_type descriptor)=0
Apply the given annotation to this type.
eprosima::fastdds::dds::DynamicTypeBuilder::equals
virtual FASTDDS_EXPORTED_API bool equals(traits< DynamicType >::ref_type other)=0
Compares current state against a DynamicType reference.
eprosima::fastdds::dds
Definition BuiltinTopicKey.hpp:26
eprosima::fastdds::dds::MemberId
uint32_t MemberId
Definition dynamic_language_binding.hpp:122
eprosima::fastdds::dds::DynamicTypeMembersById
std::map< MemberId, traits< DynamicTypeMember >::ref_type > DynamicTypeMembersById
Definition DynamicTypeMember.hpp:133
eprosima::fastdds::dds::ReturnCode_t
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eprosima::fastdds::dds::ObjectName
eprosima::fastcdr::fixed_string< 256 > ObjectName
Definition dynamic_language_binding.hpp:66
eprosima::fastdds::dds::DynamicTypeMembersByName
std::map< ObjectName, traits< DynamicTypeMember >::ref_type > DynamicTypeMembersByName
Definition DynamicTypeMember.hpp:131
eprosima::fastdds::dds::TypeKind
uint8_t TypeKind
Definition dynamic_language_binding.hpp:70
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::dds::traits::ref_type
typename ::std::shared_ptr< T > ref_type
Definition type_traits.hpp:29