| 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
19
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
30 namespace eprosima {
31 namespace fastdds {
32 namespace rtps {
33
34 class TransportInterface;
35
50 struct SharedMemTransportDescriptor : public PortBasedTransportDescriptor
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
76 FASTDDS_EXPORTED_API SharedMemTransportDescriptor& operator =(
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 {
102 maxMessageSize = max_message_size;
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(
126 uint32_t 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(
152 const ThreadSettings& dump_thread)
153 {
154 dump_thread_ = dump_thread;
155 }
156
158 FASTDDS_EXPORTED_API bool operator ==(
159 const SharedMemTransportDescriptor& t) const;
160
161 private:
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
eprosima::fastdds::rtps::PortBasedTransportDescriptor::PortBasedTransportDescriptor
FASTDDS_EXPORTED_API PortBasedTransportDescriptor(uint32_t maximumMessageSize, uint32_t maximumInitialPeersRange)
Constructor.
eprosima::fastdds::rtps::TransportInterface
Interface against which to implement a transport layer, decoupled from Fast DDS internals.
Definition TransportInterface.hpp:64
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds
eprosima
eProsima namespace.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::rtps_dump_file
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
eprosima::fastdds::rtps::SharedMemTransportDescriptor::shm_default_healthy_check_timeout_ms
static constexpr uint32_t shm_default_healthy_check_timeout_ms
Definition SharedMemTransportDescriptor.hpp:54
eprosima::fastdds::rtps::SharedMemTransportDescriptor::max_message_size
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
eprosima::fastdds::rtps::SharedMemTransportDescriptor::segment_size
FASTDDS_EXPORTED_API uint32_t segment_size() const
Return the size of the shared memory segment.
Definition SharedMemTransportDescriptor.hpp:80
eprosima::fastdds::rtps::SharedMemTransportDescriptor::shm_implicit_segment_size
static constexpr uint32_t shm_implicit_segment_size
Definition SharedMemTransportDescriptor.hpp:55
eprosima::fastdds::rtps::SharedMemTransportDescriptor::min_send_buffer_size
uint32_t min_send_buffer_size() const override
Minimum size of the send buffer.
Definition SharedMemTransportDescriptor.hpp:63
eprosima::fastdds::rtps::SharedMemTransportDescriptor::operator=
FASTDDS_EXPORTED_API SharedMemTransportDescriptor & operator=(const SharedMemTransportDescriptor &t)=default
Copy assignment.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::dump_thread
FASTDDS_EXPORTED_API ThreadSettings dump_thread() const
Return the thread settings for the transport dump thread.
Definition SharedMemTransportDescriptor.hpp:145
eprosima::fastdds::rtps::SharedMemTransportDescriptor::healthy_check_timeout_ms
FASTDDS_EXPORTED_API uint32_t healthy_check_timeout_ms() const
Return the timeout for the health check of ports (ms).
Definition SharedMemTransportDescriptor.hpp:119
eprosima::fastdds::rtps::SharedMemTransportDescriptor::port_queue_capacity
FASTDDS_EXPORTED_API uint32_t port_queue_capacity() const
Return the size of the listening port (in messages).
Definition SharedMemTransportDescriptor.hpp:106
eprosima::fastdds::rtps::SharedMemTransportDescriptor::SharedMemTransportDescriptor
FASTDDS_EXPORTED_API SharedMemTransportDescriptor(const SharedMemTransportDescriptor &t)=default
Copy constructor.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::shm_default_port_queue_capacity
static constexpr uint32_t shm_default_port_queue_capacity
Definition SharedMemTransportDescriptor.hpp:53
eprosima::fastdds::rtps::SharedMemTransportDescriptor::~SharedMemTransportDescriptor
virtual ~SharedMemTransportDescriptor()=default
Destructor.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::create_transport
virtual TransportInterface * create_transport() const override
Factory method pattern.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::SharedMemTransportDescriptor
FASTDDS_EXPORTED_API SharedMemTransportDescriptor()
Constructor.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::dump_thread
FASTDDS_EXPORTED_API void dump_thread(const ThreadSettings &dump_thread)
Set the thread settings for the transport dump thread.
Definition SharedMemTransportDescriptor.hpp:151
eprosima::fastdds::rtps::SharedMemTransportDescriptor::max_message_size
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
eprosima::fastdds::rtps::SharedMemTransportDescriptor::rtps_dump_file
FASTDDS_EXPORTED_API std::string rtps_dump_file() const
Return the full path of the protocol dump file.
Definition SharedMemTransportDescriptor.hpp:132
eprosima::fastdds::rtps::SharedMemTransportDescriptor::healthy_check_timeout_ms
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
eprosima::fastdds::rtps::SharedMemTransportDescriptor::operator==
FASTDDS_EXPORTED_API bool operator==(const SharedMemTransportDescriptor &t) const
Comparison operator.
eprosima::fastdds::rtps::SharedMemTransportDescriptor::shm_default_segment_size
static constexpr uint32_t shm_default_segment_size
Definition SharedMemTransportDescriptor.hpp:52
eprosima::fastdds::rtps::SharedMemTransportDescriptor::segment_size
FASTDDS_EXPORTED_API void segment_size(uint32_t segment_size)
Set the size of the shared memory segment.
Definition SharedMemTransportDescriptor.hpp:86
eprosima::fastdds::rtps::SharedMemTransportDescriptor::port_queue_capacity
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
eprosima::fastdds::rtps::ThreadSettings
Struct ThreadSettings to specify various thread settings.
Definition ThreadSettings.hpp:37
eprosima::fastdds::rtps::TransportDescriptorInterface::maxMessageSize
uint32_t maxMessageSize
Maximum size of a single message in the transport.
Definition TransportDescriptorInterface.hpp:123