Fast DDS  Version 3.6.1.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/OriginalWriterInfo.hpp>
24#include <fastdds/rtps/common/SampleIdentity.hpp>
25#include <fastdds/rtps/common/Time_t.hpp>
26
27namespace eprosima {
28namespace fastdds {
29namespace rtps {
30
36class FASTDDS_EXPORTED_API WriteParams
37{
38public:
39
48 struct FASTDDS_EXPORTED_API UserWriteData
49 {
50 UserWriteData() = default;
51
52 virtual ~UserWriteData() = default;
53 };
54
63 const SampleIdentity& sample_id)
64 {
65 sample_identity_ = sample_id;
66 return *this;
67 }
68
77 SampleIdentity&& sample_id)
78 {
79 sample_identity_ = std::move(sample_id);
80 return *this;
81 }
82
89 {
90 return sample_identity_;
91 }
92
99 {
100 return sample_identity_;
101 }
102
111 const SampleIdentity& sample_id)
112 {
113 related_sample_identity_ = sample_id;
114 return *this;
115 }
116
125 SampleIdentity&& sample_id)
126 {
127 related_sample_identity_ = std::move(sample_id);
128 return *this;
129 }
130
137 {
138 return related_sample_identity_;
139 }
140
147 {
148 return related_sample_identity_;
149 }
150
157 {
158 return source_timestamp_;
159 }
160
167 {
168 return source_timestamp_;
169 }
170
179 const Time_t& timestamp)
180 {
181 source_timestamp_ = timestamp;
182 return *this;
183 }
184
193 Time_t&& timestamp)
194 {
195 source_timestamp_ = std::move(timestamp);
196 return *this;
197 }
198
204 std::shared_ptr<UserWriteData> user_write_data() const
205 {
206 return user_write_data_;
207 }
208
217 std::shared_ptr<UserWriteData> write_data)
218 {
219 user_write_data_ = write_data;
220 return *this;
221 }
222
223 bool has_more_replies() const
224 {
225 return has_more_replies_;
226 }
227
229 bool more_replies)
230 {
231 has_more_replies_ = more_replies;
232 return *this;
233 }
234
240 {
241 return original_writer_info_;
242 }
243
249 {
250 return original_writer_info_;
251 }
252
261 const OriginalWriterInfo& original_writer)
262 {
263 original_writer_info_ = original_writer;
264 return *this;
265 }
266
268
281 {
282 return WriteParams();
283 }
284
285private:
286
287 class FASTDDS_EXPORTED_API UserWriteDataPtr : public std::shared_ptr<UserWriteData>
288 {
289 public:
290
291 UserWriteDataPtr(
292 std::shared_ptr<UserWriteData> ptr)
293 : std::shared_ptr<UserWriteData>(ptr)
294 {
295 }
296
297 };
298
300 SampleIdentity sample_identity_;
302 SampleIdentity related_sample_identity_;
304 Time_t source_timestamp_{ -1, TIME_T_INFINITE_NANOSECONDS };
306 UserWriteDataPtr user_write_data_{nullptr};
308 bool has_more_replies_ = false;
310 OriginalWriterInfo original_writer_info_;
311};
312
313} // namespace rtps
314} // namespace fastdds
315} // namespace eprosima
316
317#endif //FASTDDS_RTPS_COMMON__WRITEPARAMS_HPP
Definition OriginalWriterInfo.hpp:31
This class is used to specify a sample.
Definition SampleIdentity.hpp:34
Structure Time_t, used to describe times at RTPS protocol.
Definition Time_t.hpp:38
This class contains additional information of a CacheChange.
Definition WriteParams.hpp:37
WriteParams & user_write_data(std::shared_ptr< UserWriteData > write_data)
Set the user write data.
Definition WriteParams.hpp:216
SampleIdentity & sample_identity()
Set the value of the sample_identity member.
Definition WriteParams.hpp:98
SampleIdentity & related_sample_identity()
Set the value of the related_sample_identity member.
Definition WriteParams.hpp:146
const OriginalWriterInfo & original_writer_info() const
Get the Original Writer Info.
Definition WriteParams.hpp:239
WriteParams & source_timestamp(const Time_t &timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:178
WriteParams & sample_identity(const SampleIdentity &sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:62
WriteParams & original_writer_info(const OriginalWriterInfo &original_writer)
Set the Original Writer Info of the original writer.
Definition WriteParams.hpp:260
static WriteParams write_params_default() noexcept
Default value for methods receiving a WriteParams.
Definition WriteParams.hpp:280
WriteParams & has_more_replies(bool more_replies)
Definition WriteParams.hpp:228
Time_t & source_timestamp()
Set the value of the source_timestamp member.
Definition WriteParams.hpp:166
const SampleIdentity & related_sample_identity() const
Get the value of the related_sample_identity member.
Definition WriteParams.hpp:136
bool has_more_replies() const
Definition WriteParams.hpp:223
std::shared_ptr< UserWriteData > user_write_data() const
Retrieves the user write data.
Definition WriteParams.hpp:204
const SampleIdentity & sample_identity() const
Get the value of the sample_identity member.
Definition WriteParams.hpp:88
Time_t source_timestamp() const
Get the value of the source_timestamp member.
Definition WriteParams.hpp:156
WriteParams & related_sample_identity(SampleIdentity &&sample_id)
Set the related_sample_identity member of this class.
Definition WriteParams.hpp:124
WriteParams & sample_identity(SampleIdentity &&sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:76
WriteParams & related_sample_identity(const SampleIdentity &sample_id)
Set the value of the related_sample_identity member of this class.
Definition WriteParams.hpp:110
OriginalWriterInfo & original_writer_info()
Get the Original Writer Info.
Definition WriteParams.hpp:248
static WriteParams WRITE_PARAM_DEFAULT
Definition WriteParams.hpp:267
WriteParams & source_timestamp(Time_t &&timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:192
Contains the RTPS protocol implementation.
eProsima namespace.
Definition EntityId_t.hpp:388