Fast DDS  Version 3.1.2
Fast DDS
Loading...
Searching...
No Matches
TransportDescriptorInterface.hpp
1// Copyright 2019 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
20#ifndef FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
21#define FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
22
23#include <cstdint>
24#include <mutex>
25#include <vector>
26
27#include <fastdds/fastdds_dll.hpp>
28
29namespace eprosima {
30namespace fastdds {
31namespace rtps {
32
33class TransportInterface;
34
48{
50 FASTDDS_EXPORTED_API TransportDescriptorInterface(
51 uint32_t maximumMessageSize,
52 uint32_t maximumInitialPeersRange)
53 : maxMessageSize(maximumMessageSize)
54 , maxInitialPeersRange(maximumInitialPeersRange)
55 {
56 }
57
65
74
76 virtual FASTDDS_EXPORTED_API ~TransportDescriptorInterface() = default;
77
83 virtual FASTDDS_EXPORTED_API TransportInterface* create_transport() const = 0;
84
86 virtual FASTDDS_EXPORTED_API uint32_t min_send_buffer_size() const = 0;
87
89 virtual FASTDDS_EXPORTED_API uint32_t max_message_size() const
90 {
91 return maxMessageSize;
92 }
93
97 virtual FASTDDS_EXPORTED_API uint32_t max_initial_peers_range() const
98 {
100 }
101
103 FASTDDS_EXPORTED_API bool operator ==(
104 const TransportDescriptorInterface& t) const
105 {
106 return (this->maxMessageSize == t.max_message_size() &&
107 this->maxInitialPeersRange == t.max_initial_peers_range());
108 }
109
111 FASTDDS_EXPORTED_API void lock()
112 {
113 mtx_.lock();
114 }
115
117 FASTDDS_EXPORTED_API void unlock()
118 {
119 mtx_.unlock();
120 }
121
124
127
128private:
129
130 mutable std::mutex mtx_;
131};
132
133} // namespace rtps
134} // namespace fastdds
135} // namespace eprosima
136
137#endif // FASTDDS_RTPS_TRANSPORT__TRANSPORTDESCRIPTORINTERFACE_HPP
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition TransportInterface.hpp:64
eProsima namespace.
Virtual base class for the data type used to define transport configuration.
Definition TransportDescriptorInterface.hpp:48
virtual FASTDDS_EXPORTED_API ~TransportDescriptorInterface()=default
Destructor.
FASTDDS_EXPORTED_API void unlock()
Unlock internal mutex (for Fast-DDS internal use)
Definition TransportDescriptorInterface.hpp:117
FASTDDS_EXPORTED_API TransportDescriptorInterface & operator=(const TransportDescriptorInterface &t)
Copy assignment.
Definition TransportDescriptorInterface.hpp:67
virtual FASTDDS_EXPORTED_API uint32_t max_message_size() const
Returns the maximum size expected for received messages.
Definition TransportDescriptorInterface.hpp:89
uint32_t maxMessageSize
Maximum size of a single message in the transport.
Definition TransportDescriptorInterface.hpp:123
FASTDDS_EXPORTED_API TransportDescriptorInterface(const TransportDescriptorInterface &t)
Copy constructor.
Definition TransportDescriptorInterface.hpp:59
virtual FASTDDS_EXPORTED_API TransportInterface * create_transport() const =0
Factory method pattern.
virtual FASTDDS_EXPORTED_API uint32_t min_send_buffer_size() const =0
Returns the minimum size required for a send operation.
FASTDDS_EXPORTED_API void lock()
Lock internal mutex (for Fast-DDS internal use)
Definition TransportDescriptorInterface.hpp:111
virtual FASTDDS_EXPORTED_API uint32_t max_initial_peers_range() const
Returns the maximum number of opened channels for each initial remote peer (maximum number of guessed...
Definition TransportDescriptorInterface.hpp:97
FASTDDS_EXPORTED_API TransportDescriptorInterface(uint32_t maximumMessageSize, uint32_t maximumInitialPeersRange)
Constructor.
Definition TransportDescriptorInterface.hpp:50
uint32_t maxInitialPeersRange
Number of channels opened with each initial remote peer.
Definition TransportDescriptorInterface.hpp:126
FASTDDS_EXPORTED_API bool operator==(const TransportDescriptorInterface &t) const
Comparison operator.
Definition TransportDescriptorInterface.hpp:103