Fast DDS  Version 3.3.0
Fast DDS
Loading...
Searching...
No Matches
SharedMemTransportDescriptor.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_SHARED_MEM__SHAREDMEMTRANSPORTDESCRIPTOR_HPP
21#define FASTDDS_RTPS_TRANSPORT_SHARED_MEM__SHAREDMEMTRANSPORTDESCRIPTOR_HPP
22
23#include <cstdint>
24#include <string>
25
26#include <fastdds/rtps/attributes/ThreadSettings.hpp>
27#include <fastdds/rtps/transport/PortBasedTransportDescriptor.hpp>
28#include <fastdds/fastdds_dll.hpp>
29
30namespace eprosima {
31namespace fastdds {
32namespace rtps {
33
34class TransportInterface;
35
51{
52 static constexpr uint32_t shm_default_segment_size = 0;
53 static constexpr uint32_t shm_default_port_queue_capacity = 512;
54 static constexpr uint32_t shm_default_healthy_check_timeout_ms = 1000;
55 static constexpr uint32_t shm_implicit_segment_size = 512 * 1024;
56
58 virtual ~SharedMemTransportDescriptor() = default;
59
60 virtual TransportInterface* create_transport() const override;
61
63 uint32_t min_send_buffer_size() const override
64 {
65 return segment_size_;
66 }
67
69 FASTDDS_EXPORTED_API SharedMemTransportDescriptor();
70
72 FASTDDS_EXPORTED_API SharedMemTransportDescriptor(
73 const SharedMemTransportDescriptor& t) = default;
74
77 const SharedMemTransportDescriptor& t) = default;
78
80 FASTDDS_EXPORTED_API uint32_t segment_size() const
81 {
82 return segment_size_;
83 }
84
86 FASTDDS_EXPORTED_API void segment_size(
87 uint32_t segment_size)
88 {
89 segment_size_ = segment_size;
90 }
91
93 virtual uint32_t max_message_size() const override
94 {
95 return maxMessageSize;
96 }
97
99 FASTDDS_EXPORTED_API void max_message_size(
100 uint32_t max_message_size)
101 {
103 }
104
106 FASTDDS_EXPORTED_API uint32_t port_queue_capacity() const
107 {
108 return port_queue_capacity_;
109 }
110
112 FASTDDS_EXPORTED_API void port_queue_capacity(
113 uint32_t port_queue_capacity)
114 {
115 port_queue_capacity_ = port_queue_capacity;
116 }
117
119 FASTDDS_EXPORTED_API uint32_t healthy_check_timeout_ms() const
120 {
121 return healthy_check_timeout_ms_;
122 }
123
125 FASTDDS_EXPORTED_API void healthy_check_timeout_ms(
127 {
128 healthy_check_timeout_ms_ = healthy_check_timeout_ms;
129 }
130
132 FASTDDS_EXPORTED_API std::string rtps_dump_file() const
133 {
134 return rtps_dump_file_;
135 }
136
138 FASTDDS_EXPORTED_API void rtps_dump_file(
139 const std::string& rtps_dump_file)
140 {
141 rtps_dump_file_ = rtps_dump_file;
142 }
143
145 FASTDDS_EXPORTED_API ThreadSettings dump_thread() const
146 {
147 return dump_thread_;
148 }
149
151 FASTDDS_EXPORTED_API void dump_thread(
153 {
154 dump_thread_ = dump_thread;
155 }
156
158 FASTDDS_EXPORTED_API bool operator ==(
159 const SharedMemTransportDescriptor& t) const;
160
161private:
162
163 uint32_t segment_size_ = shm_default_segment_size;
164 uint32_t port_queue_capacity_ = shm_default_port_queue_capacity;
165 uint32_t healthy_check_timeout_ms_ = shm_default_healthy_check_timeout_ms;
166 std::string rtps_dump_file_ {""};
167
169 ThreadSettings dump_thread_ {};
170
171};
172
173} // namespace rtps
174} // namespace fastdds
175} // namespace eprosima
176
177#endif // FASTDDS_RTPS_TRANSPORT_SHARED_MEM__SHAREDMEMTRANSPORTDESCRIPTOR_HPP
Base class for all port based transport descriptors.
Definition PortBasedTransportDescriptor.hpp:38
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition TransportInterface.hpp:64
eProsima namespace.
Shared memory transport configuration.
Definition SharedMemTransportDescriptor.hpp:51
FASTDDS_EXPORTED_API void rtps_dump_file(const std::string &rtps_dump_file)
Set the full path of the protocol dump file.
Definition SharedMemTransportDescriptor.hpp:138
static constexpr uint32_t shm_default_healthy_check_timeout_ms
Definition SharedMemTransportDescriptor.hpp:54
FASTDDS_EXPORTED_API void max_message_size(uint32_t max_message_size)
Set the maximum size of a single message in the transport (in octets)
Definition SharedMemTransportDescriptor.hpp:99
FASTDDS_EXPORTED_API uint32_t segment_size() const
Return the size of the shared memory segment.
Definition SharedMemTransportDescriptor.hpp:80
static constexpr uint32_t shm_implicit_segment_size
Definition SharedMemTransportDescriptor.hpp:55
uint32_t min_send_buffer_size() const override
Minimum size of the send buffer.
Definition SharedMemTransportDescriptor.hpp:63
FASTDDS_EXPORTED_API SharedMemTransportDescriptor & operator=(const SharedMemTransportDescriptor &t)=default
Copy assignment.
FASTDDS_EXPORTED_API ThreadSettings dump_thread() const
Return the thread settings for the transport dump thread.
Definition SharedMemTransportDescriptor.hpp:145
FASTDDS_EXPORTED_API uint32_t healthy_check_timeout_ms() const
Return the timeout for the health check of ports (ms)
Definition SharedMemTransportDescriptor.hpp:119
FASTDDS_EXPORTED_API uint32_t port_queue_capacity() const
Return the size of the listening port (in messages)
Definition SharedMemTransportDescriptor.hpp:106
FASTDDS_EXPORTED_API SharedMemTransportDescriptor(const SharedMemTransportDescriptor &t)=default
Copy constructor.
static constexpr uint32_t shm_default_port_queue_capacity
Definition SharedMemTransportDescriptor.hpp:53
virtual ~SharedMemTransportDescriptor()=default
Destructor.
virtual TransportInterface * create_transport() const override
Factory method pattern.
FASTDDS_EXPORTED_API SharedMemTransportDescriptor()
Constructor.
FASTDDS_EXPORTED_API void dump_thread(const ThreadSettings &dump_thread)
Set the thread settings for the transport dump thread.
Definition SharedMemTransportDescriptor.hpp:151
virtual uint32_t max_message_size() const override
Return the maximum size of a single message in the transport (in octets)
Definition SharedMemTransportDescriptor.hpp:93
FASTDDS_EXPORTED_API std::string rtps_dump_file() const
Return the full path of the protocol dump file.
Definition SharedMemTransportDescriptor.hpp:132
FASTDDS_EXPORTED_API void healthy_check_timeout_ms(uint32_t healthy_check_timeout_ms)
Set the timeout for the health check of ports (ms)
Definition SharedMemTransportDescriptor.hpp:125
FASTDDS_EXPORTED_API bool operator==(const SharedMemTransportDescriptor &t) const
Comparison operator.
static constexpr uint32_t shm_default_segment_size
Definition SharedMemTransportDescriptor.hpp:52
FASTDDS_EXPORTED_API void segment_size(uint32_t segment_size)
Set the size of the shared memory segment.
Definition SharedMemTransportDescriptor.hpp:86
FASTDDS_EXPORTED_API void port_queue_capacity(uint32_t port_queue_capacity)
Set the size of the listening port (in messages)
Definition SharedMemTransportDescriptor.hpp:112
Struct ThreadSettings to specify various thread settings.
Definition ThreadSettings.hpp:37
uint32_t maxMessageSize
Maximum size of a single message in the transport.
Definition TransportDescriptorInterface.hpp:123