| Fast DDS Version 3.3.0 Fast DDS

Loading...
Searching...
No Matches
WriteParams.hpp
1// Copyright 2016 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
18#ifndef FASTDDS_RTPS_COMMON__WRITEPARAMS_HPP
19#define FASTDDS_RTPS_COMMON__WRITEPARAMS_HPP
20
21#include <memory>
22
23#include <fastdds/rtps/common/SampleIdentity.hpp>
24#include <fastdds/rtps/common/Time_t.hpp>
25
26 namespace eprosima {
27 namespace fastdds {
28 namespace rtps {
29
35 class FASTDDS_EXPORTED_API WriteParams
36{
37 public:
38
47 struct FASTDDS_EXPORTED_API UserWriteData
48 {
49 UserWriteData() = default;
50
51 virtual ~UserWriteData() = default;
52 };
53
61 WriteParams& sample_identity(
62 const SampleIdentity& sample_id)
63 {
64 sample_identity_ = sample_id;
65 return *this;
66 }
67
75 WriteParams& sample_identity(
76 SampleIdentity&& sample_id)
77 {
78 sample_identity_ = std::move(sample_id);
79 return *this;
80 }
81
87 const SampleIdentity& sample_identity() const
88 {
89 return sample_identity_;
90 }
91
97 SampleIdentity& sample_identity()
98 {
99 return sample_identity_;
100 }
101
109 WriteParams& related_sample_identity(
110 const SampleIdentity& sample_id)
111 {
112 related_sample_identity_ = sample_id;
113 return *this;
114 }
115
123 WriteParams& related_sample_identity(
124 SampleIdentity&& sample_id)
125 {
126 related_sample_identity_ = std::move(sample_id);
127 return *this;
128 }
129
135 const SampleIdentity& related_sample_identity() const
136 {
137 return related_sample_identity_;
138 }
139
145 SampleIdentity& related_sample_identity()
146 {
147 return related_sample_identity_;
148 }
149
155 Time_t source_timestamp() const
156 {
157 return source_timestamp_;
158 }
159
165 Time_t& source_timestamp()
166 {
167 return source_timestamp_;
168 }
169
177 WriteParams& source_timestamp(
178 const Time_t& timestamp)
179 {
180 source_timestamp_ = timestamp;
181 return *this;
182 }
183
191 WriteParams& source_timestamp(
192 Time_t&& timestamp)
193 {
194 source_timestamp_ = std::move(timestamp);
195 return *this;
196 }
197
203 std::shared_ptr<UserWriteData> user_write_data() const
204 {
205 return user_write_data_;
206 }
207
215 WriteParams& user_write_data(
216 std::shared_ptr<UserWriteData> write_data)
217 {
218 user_write_data_ = write_data;
219 return *this;
220 }
221
222 bool has_more_replies() const
223 {
224 return has_more_replies_;
225 }
226
227 WriteParams& has_more_replies(
228 bool more_replies)
229 {
230 has_more_replies_ = more_replies;
231 return *this;
232 }
233
234 static WriteParams WRITE_PARAM_DEFAULT;
235
247 static WriteParams write_params_default() noexcept
248 {
249 return WriteParams();
250 }
251
252 private:
253
254 class FASTDDS_EXPORTED_API UserWriteDataPtr : public std::shared_ptr<UserWriteData>
255 {
256 public:
257
258 UserWriteDataPtr(
259 std::shared_ptr<UserWriteData> ptr)
260 : std::shared_ptr<UserWriteData>(ptr)
261 {
262 }
263
264 };
265
267 SampleIdentity sample_identity_;
269 SampleIdentity related_sample_identity_;
271 Time_t source_timestamp_{ -1, TIME_T_INFINITE_NANOSECONDS };
273 UserWriteDataPtr user_write_data_{nullptr};
275 bool has_more_replies_ = false;
276};
277
278} // namespace rtps
279} // namespace fastdds
280} // namespace eprosima
281
282#endif //FASTDDS_RTPS_COMMON__WRITEPARAMS_HPP
eprosima::fastdds::rtps::SampleIdentity
This class is used to specify a sample.
Definition SampleIdentity.hpp:34
eprosima::fastdds::rtps::Time_t
Structure Time_t, used to describe times at RTPS protocol.
Definition Time_t.hpp:38
eprosima::fastdds::rtps::WriteParams
This class contains additional information of a CacheChange.
Definition WriteParams.hpp:36
eprosima::fastdds::rtps::WriteParams::user_write_data
WriteParams & user_write_data(std::shared_ptr< UserWriteData > write_data)
Set the user write data.
Definition WriteParams.hpp:215
eprosima::fastdds::rtps::WriteParams::sample_identity
SampleIdentity & sample_identity()
Set the value of the sample_identity member.
Definition WriteParams.hpp:97
eprosima::fastdds::rtps::WriteParams::related_sample_identity
SampleIdentity & related_sample_identity()
Set the value of the related_sample_identity member.
Definition WriteParams.hpp:145
eprosima::fastdds::rtps::WriteParams::source_timestamp
WriteParams & source_timestamp(const Time_t &timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:177
eprosima::fastdds::rtps::WriteParams::sample_identity
WriteParams & sample_identity(const SampleIdentity &sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:61
eprosima::fastdds::rtps::WriteParams::write_params_default
static WriteParams write_params_default() noexcept
Default value for methods receiving a WriteParams.
Definition WriteParams.hpp:247
eprosima::fastdds::rtps::WriteParams::has_more_replies
WriteParams & has_more_replies(bool more_replies)
Definition WriteParams.hpp:227
eprosima::fastdds::rtps::WriteParams::source_timestamp
Time_t & source_timestamp()
Set the value of the source_timestamp member.
Definition WriteParams.hpp:165
eprosima::fastdds::rtps::WriteParams::related_sample_identity
const SampleIdentity & related_sample_identity() const
Get the value of the related_sample_identity member.
Definition WriteParams.hpp:135
eprosima::fastdds::rtps::WriteParams::has_more_replies
bool has_more_replies() const
Definition WriteParams.hpp:222
eprosima::fastdds::rtps::WriteParams::user_write_data
std::shared_ptr< UserWriteData > user_write_data() const
Retrieves the user write data.
Definition WriteParams.hpp:203
eprosima::fastdds::rtps::WriteParams::sample_identity
const SampleIdentity & sample_identity() const
Get the value of the sample_identity member.
Definition WriteParams.hpp:87
eprosima::fastdds::rtps::WriteParams::source_timestamp
Time_t source_timestamp() const
Get the value of the source_timestamp member.
Definition WriteParams.hpp:155
eprosima::fastdds::rtps::WriteParams::related_sample_identity
WriteParams & related_sample_identity(SampleIdentity &&sample_id)
Set the related_sample_identity member of this class.
Definition WriteParams.hpp:123
eprosima::fastdds::rtps::WriteParams::sample_identity
WriteParams & sample_identity(SampleIdentity &&sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:75
eprosima::fastdds::rtps::WriteParams::related_sample_identity
WriteParams & related_sample_identity(const SampleIdentity &sample_id)
Set the value of the related_sample_identity member of this class.
Definition WriteParams.hpp:109
eprosima::fastdds::rtps::WriteParams::WRITE_PARAM_DEFAULT
static WriteParams WRITE_PARAM_DEFAULT
Definition WriteParams.hpp:234
eprosima::fastdds::rtps::WriteParams::source_timestamp
WriteParams & source_timestamp(Time_t &&timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:191
eprosima::fastdds::rtps
Contains the RTPS protocol implementation.
eprosima::fastdds
eprosima
eProsima namespace.
std
Definition EntityId_t.hpp:388
eprosima::fastdds::rtps::WriteParams::UserWriteData::~UserWriteData
virtual ~UserWriteData()=default
eprosima::fastdds::rtps::WriteParams::UserWriteData::UserWriteData
UserWriteData()=default