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
26namespace eprosima {
27namespace fastdds {
28namespace rtps {
29
35class FASTDDS_EXPORTED_API WriteParams
36{
37public:
38
47 struct FASTDDS_EXPORTED_API UserWriteData
48 {
49 UserWriteData() = default;
50
51 virtual ~UserWriteData() = default;
52 };
53
62 const SampleIdentity& sample_id)
63 {
64 sample_identity_ = sample_id;
65 return *this;
66 }
67
76 SampleIdentity&& sample_id)
77 {
78 sample_identity_ = std::move(sample_id);
79 return *this;
80 }
81
88 {
89 return sample_identity_;
90 }
91
98 {
99 return sample_identity_;
100 }
101
110 const SampleIdentity& sample_id)
111 {
112 related_sample_identity_ = sample_id;
113 return *this;
114 }
115
124 SampleIdentity&& sample_id)
125 {
126 related_sample_identity_ = std::move(sample_id);
127 return *this;
128 }
129
136 {
137 return related_sample_identity_;
138 }
139
146 {
147 return related_sample_identity_;
148 }
149
156 {
157 return source_timestamp_;
158 }
159
166 {
167 return source_timestamp_;
168 }
169
178 const Time_t& timestamp)
179 {
180 source_timestamp_ = timestamp;
181 return *this;
182 }
183
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
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
228 bool more_replies)
229 {
230 has_more_replies_ = more_replies;
231 return *this;
232 }
233
235
248 {
249 return WriteParams();
250 }
251
252private:
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
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:36
WriteParams & user_write_data(std::shared_ptr< UserWriteData > write_data)
Set the user write data.
Definition WriteParams.hpp:215
SampleIdentity & sample_identity()
Set the value of the sample_identity member.
Definition WriteParams.hpp:97
SampleIdentity & related_sample_identity()
Set the value of the related_sample_identity member.
Definition WriteParams.hpp:145
WriteParams & source_timestamp(const Time_t &timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:177
WriteParams & sample_identity(const SampleIdentity &sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:61
static WriteParams write_params_default() noexcept
Default value for methods receiving a WriteParams.
Definition WriteParams.hpp:247
WriteParams & has_more_replies(bool more_replies)
Definition WriteParams.hpp:227
Time_t & source_timestamp()
Set the value of the source_timestamp member.
Definition WriteParams.hpp:165
const SampleIdentity & related_sample_identity() const
Get the value of the related_sample_identity member.
Definition WriteParams.hpp:135
bool has_more_replies() const
Definition WriteParams.hpp:222
std::shared_ptr< UserWriteData > user_write_data() const
Retrieves the user write data.
Definition WriteParams.hpp:203
const SampleIdentity & sample_identity() const
Get the value of the sample_identity member.
Definition WriteParams.hpp:87
Time_t source_timestamp() const
Get the value of the source_timestamp member.
Definition WriteParams.hpp:155
WriteParams & related_sample_identity(SampleIdentity &&sample_id)
Set the related_sample_identity member of this class.
Definition WriteParams.hpp:123
WriteParams & sample_identity(SampleIdentity &&sample_id)
Set the value of the sample_identity member.
Definition WriteParams.hpp:75
WriteParams & related_sample_identity(const SampleIdentity &sample_id)
Set the value of the related_sample_identity member of this class.
Definition WriteParams.hpp:109
static WriteParams WRITE_PARAM_DEFAULT
Definition WriteParams.hpp:234
WriteParams & source_timestamp(Time_t &&timestamp)
Set the source_timestamp member of this class.
Definition WriteParams.hpp:191
eProsima namespace.
Definition EntityId_t.hpp:388
Base class storing custom information in the WriteParams structure for later filtering.
Definition WriteParams.hpp:48