| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
ServiceTypeSupport.hpp
1// Copyright 2025 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_RPC__SERVICETYPESUPPORT_HPP
16#define FASTDDS_DDS_RPC__SERVICETYPESUPPORT_HPP
17
18#include <fastdds/dds/topic/TypeSupport.hpp>
19#include <fastdds/fastdds_dll.hpp>
20
21 namespace eprosima {
22 namespace fastdds {
23 namespace dds {
24 namespace rpc {
25
26 class ServiceTypeSupport
27{
28 public:
29
33 FASTDDS_EXPORTED_API ServiceTypeSupport() noexcept = default;
34
40 FASTDDS_EXPORTED_API ServiceTypeSupport(
41 const ServiceTypeSupport& service_type) noexcept = default;
42
48 FASTDDS_EXPORTED_API ServiceTypeSupport(
49 ServiceTypeSupport&& service_type) noexcept = default;
50
56 FASTDDS_EXPORTED_API ServiceTypeSupport& operator = (
57 const ServiceTypeSupport& service_type) noexcept = default;
58
64 FASTDDS_EXPORTED_API ServiceTypeSupport& operator = (
65 ServiceTypeSupport&& service_type) noexcept = default;
66
73 FASTDDS_EXPORTED_API ServiceTypeSupport(
74 TypeSupport request_type,
75 TypeSupport reply_type)
76 : request_type_(request_type)
77 , reply_type_(reply_type)
78
79 {
80 }
81
85 FASTDDS_EXPORTED_API virtual ~ServiceTypeSupport() = default;
86
95 FASTDDS_EXPORTED_API virtual ReturnCode_t register_service_type(
96 DomainParticipant* participant,
97 std::string service_type_name) const;
98
102 FASTDDS_EXPORTED_API const TypeSupport request_type() const
103 {
104 return request_type_;
105 }
106
110 FASTDDS_EXPORTED_API const TypeSupport reply_type() const
111 {
112 return reply_type_;
113 }
114
118 FASTDDS_EXPORTED_API inline bool empty_types() const
119 {
120 return request_type_.empty() || reply_type_.empty();
121 }
122
123 FASTDDS_EXPORTED_API bool operator ==(
124 const ServiceTypeSupport& type_support)
125 {
126 TypeSupport request_type = type_support.request_type();
127 TypeSupport reply_type = type_support.reply_type();
128
129 return request_type == this->request_type() && reply_type == this->reply_type();
130 }
131
132 private:
133
134 TypeSupport request_type_;
135 TypeSupport reply_type_;
136
137};
138} // namespace rpc
139} // namespace dds
140} // namespace fastdds
141} // namespace eprosima
142
143#endif // FASTDDS_DDS_RPC__SERVICETYPESUPPORT_HPP
eprosima::fastdds::dds::DomainParticipant
Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
Definition DomainParticipant.hpp:86
eprosima::fastdds::dds::TypeSupport
Class TypeSupport used to provide the DomainRTPSParticipant with the methods to serialize,...
Definition TypeSupport.hpp:47
eprosima::fastdds::dds::rpc::ServiceTypeSupport::register_service_type
virtual FASTDDS_EXPORTED_API ReturnCode_t register_service_type(DomainParticipant *participant, std::string service_type_name) const
Registers the service type on a participant.
eprosima::fastdds::dds::rpc::ServiceTypeSupport::operator==
FASTDDS_EXPORTED_API bool operator==(const ServiceTypeSupport &type_support)
Definition ServiceTypeSupport.hpp:123
eprosima::fastdds::dds::rpc::ServiceTypeSupport::ServiceTypeSupport
FASTDDS_EXPORTED_API ServiceTypeSupport() noexcept=default
Constructor.
eprosima::fastdds::dds::rpc::ServiceTypeSupport::reply_type
FASTDDS_EXPORTED_API const TypeSupport reply_type() const
Returns the TypeSupport of the reply type.
Definition ServiceTypeSupport.hpp:110
eprosima::fastdds::dds::rpc::ServiceTypeSupport::request_type
FASTDDS_EXPORTED_API const TypeSupport request_type() const
Returns the TypeSupport of the request type.
Definition ServiceTypeSupport.hpp:102
eprosima::fastdds::dds::rpc::ServiceTypeSupport::empty_types
FASTDDS_EXPORTED_API bool empty_types() const
Check if the ServiceTypeSupport object contains empty request/reply types.
Definition ServiceTypeSupport.hpp:118
eprosima::fastdds::dds::rpc::ServiceTypeSupport::~ServiceTypeSupport
virtual FASTDDS_EXPORTED_API ~ServiceTypeSupport()=default
Destructor.
eprosima::fastdds::dds::rpc
Definition DomainParticipant.hpp:59
eprosima::fastdds::dds
Definition BuiltinTopicKey.hpp:26
eprosima::fastdds::dds::ReturnCode_t
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eprosima::fastdds
eprosima
eProsima namespace.