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
21namespace eprosima {
22namespace fastdds {
23namespace dds {
24namespace rpc {
25
27{
28public:
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(
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
132private:
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
Class DomainParticipant used to group Publishers and Subscribers into a single working unit.
Definition DomainParticipant.hpp:86
Class TypeSupport used to provide the DomainRTPSParticipant with the methods to serialize,...
Definition TypeSupport.hpp:47
FASTDDS_EXPORTED_API bool empty() const
Check if the TypeSupport is empty.
Definition TypeSupport.hpp:239
Definition ServiceTypeSupport.hpp:27
virtual FASTDDS_EXPORTED_API ReturnCode_t register_service_type(DomainParticipant *participant, std::string service_type_name) const
Registers the service type on a participant.
FASTDDS_EXPORTED_API bool operator==(const ServiceTypeSupport &type_support)
Definition ServiceTypeSupport.hpp:123
FASTDDS_EXPORTED_API ServiceTypeSupport() noexcept=default
Constructor.
FASTDDS_EXPORTED_API const TypeSupport reply_type() const
Returns the TypeSupport of the reply type.
Definition ServiceTypeSupport.hpp:110
FASTDDS_EXPORTED_API const TypeSupport request_type() const
Returns the TypeSupport of the request type.
Definition ServiceTypeSupport.hpp:102
FASTDDS_EXPORTED_API bool empty_types() const
Check if the ServiceTypeSupport object contains empty request/reply types.
Definition ServiceTypeSupport.hpp:118
virtual FASTDDS_EXPORTED_API ~ServiceTypeSupport()=default
Destructor.
Definition DomainParticipant.hpp:46
int32_t ReturnCode_t
Definition DDSReturnCode.hpp:59
eProsima namespace.