/src/Fast-DDS/include/fastdds/rtps/common/WriteParams.h
Line | Count | Source (jump to first uncovered line) |
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 | | |
15 | | /** |
16 | | * @file WriteParams.h |
17 | | */ |
18 | | #ifndef _FASTDDS_RTPS_COMMON_WRITEPARAMS_H_ |
19 | | #define _FASTDDS_RTPS_COMMON_WRITEPARAMS_H_ |
20 | | |
21 | | #include <fastdds/rtps/common/SampleIdentity.h> |
22 | | #include <fastdds/rtps/common/Time_t.h> |
23 | | |
24 | | namespace eprosima { |
25 | | namespace fastrtps { |
26 | | namespace rtps { |
27 | | |
28 | | /*! |
29 | | * @brief This class contains additional information of a CacheChange. |
30 | | * |
31 | | * @ingroup COMMON_MODULE |
32 | | */ |
33 | | class RTPS_DllAPI WriteParams |
34 | | { |
35 | | public: |
36 | | |
37 | | /** |
38 | | * Set the value of the sample_identity member. |
39 | | * |
40 | | * @param sample_id New value for the sample_identity member. |
41 | | * |
42 | | * @return Reference to the modified object in order to allow daisy chaining. |
43 | | */ |
44 | | WriteParams& sample_identity( |
45 | | const SampleIdentity& sample_id) |
46 | 0 | { |
47 | 0 | sample_identity_ = sample_id; |
48 | 0 | return *this; |
49 | 0 | } |
50 | | |
51 | | /** |
52 | | * Set the value of the sample_identity member. |
53 | | * |
54 | | * @param sample_id New value for the sample_identity member. |
55 | | * |
56 | | * @return Reference to the modified object in order to allow daisy chaining. |
57 | | */ |
58 | | WriteParams& sample_identity( |
59 | | SampleIdentity&& sample_id) |
60 | 0 | { |
61 | 0 | sample_identity_ = std::move(sample_id); |
62 | 0 | return *this; |
63 | 0 | } |
64 | | |
65 | | /** |
66 | | * Get the value of the sample_identity member. |
67 | | * |
68 | | * @return Constant reference to the sample_identity member. |
69 | | */ |
70 | | const SampleIdentity& sample_identity() const |
71 | 0 | { |
72 | 0 | return sample_identity_; |
73 | 0 | } |
74 | | |
75 | | /** |
76 | | * Set the value of the sample_identity member. |
77 | | * |
78 | | * @return Reference to the sample_identity member. |
79 | | */ |
80 | | SampleIdentity& sample_identity() |
81 | 0 | { |
82 | 0 | return sample_identity_; |
83 | 0 | } |
84 | | |
85 | | /** |
86 | | * Set the value of the related_sample_identity member of this class. |
87 | | * |
88 | | * @param sample_id New value for the related_sample_identity member. |
89 | | * |
90 | | * @return Reference to the modified object in order to allow daisy chaining. |
91 | | */ |
92 | | WriteParams& related_sample_identity( |
93 | | const SampleIdentity& sample_id) |
94 | 0 | { |
95 | 0 | related_sample_identity_ = sample_id; |
96 | 0 | return *this; |
97 | 0 | } |
98 | | |
99 | | /** |
100 | | * Set the related_sample_identity member of this class. |
101 | | * |
102 | | * @param sample_id New value for the related_sample_identity member. |
103 | | * |
104 | | * @return Reference to the modified object in order to allow daisy chaining. |
105 | | */ |
106 | | WriteParams& related_sample_identity( |
107 | | SampleIdentity&& sample_id) |
108 | 0 | { |
109 | 0 | related_sample_identity_ = std::move(sample_id); |
110 | 0 | return *this; |
111 | 0 | } |
112 | | |
113 | | /** |
114 | | * Get the value of the related_sample_identity member. |
115 | | * |
116 | | * @return Constant reference to the related_sample_identity member. |
117 | | */ |
118 | | const SampleIdentity& related_sample_identity() const |
119 | 0 | { |
120 | 0 | return related_sample_identity_; |
121 | 0 | } |
122 | | |
123 | | /** |
124 | | * Set the value of the related_sample_identity member. |
125 | | * |
126 | | * @return Reference to the related_sample_identity member. |
127 | | */ |
128 | | SampleIdentity& related_sample_identity() |
129 | 0 | { |
130 | 0 | return related_sample_identity_; |
131 | 0 | } |
132 | | |
133 | | /** |
134 | | * Get the value of the source_timestamp member. |
135 | | * |
136 | | * @return Current value of the source_timestamp member. |
137 | | */ |
138 | | Time_t source_timestamp() const |
139 | 0 | { |
140 | 0 | return source_timestamp_; |
141 | 0 | } |
142 | | |
143 | | /** |
144 | | * Set the value of the source_timestamp member. |
145 | | * |
146 | | * @return Reference to the source_timestamp member. |
147 | | */ |
148 | | Time_t& source_timestamp() |
149 | 0 | { |
150 | 0 | return source_timestamp_; |
151 | 0 | } |
152 | | |
153 | | /** |
154 | | * Set the source_timestamp member of this class. |
155 | | * |
156 | | * @param timestamp New value for the source_timestamp member. |
157 | | * |
158 | | * @return Reference to the modified object in order to allow daisy chaining. |
159 | | */ |
160 | | WriteParams& source_timestamp( |
161 | | const Time_t& timestamp) |
162 | 0 | { |
163 | 0 | source_timestamp_ = timestamp; |
164 | 0 | return *this; |
165 | 0 | } |
166 | | |
167 | | /** |
168 | | * Set the source_timestamp member of this class. |
169 | | * |
170 | | * @param timestamp New value for the source_timestamp member. |
171 | | * |
172 | | * @return Reference to the modified object in order to allow daisy chaining. |
173 | | */ |
174 | | WriteParams& source_timestamp( |
175 | | Time_t&& timestamp) |
176 | 0 | { |
177 | 0 | source_timestamp_ = std::move(timestamp); |
178 | 0 | return *this; |
179 | 0 | } |
180 | | |
181 | | /** |
182 | | * Default value for methods receiving a WriteParams. |
183 | | * |
184 | | * Will contain the following values on its members: |
185 | | * - sample_identity: Invalid SampleIdentity |
186 | | * - related_sample_identity: Invalid SampleIdentity |
187 | | * - source_timestamp: Invalid Time_t |
188 | | */ |
189 | | static WriteParams WRITE_PARAM_DEFAULT; |
190 | | |
191 | | private: |
192 | | |
193 | | /// Attribute that holds sample_identity member value |
194 | | SampleIdentity sample_identity_; |
195 | | /// Attribute that holds related_sample_identity member value |
196 | | SampleIdentity related_sample_identity_; |
197 | | /// Attribute that holds source_timestamp member value |
198 | | Time_t source_timestamp_{ -1, TIME_T_INFINITE_NANOSECONDS }; |
199 | | }; |
200 | | |
201 | | } // namespace rtps |
202 | | } // namespace fastrtps |
203 | | } // namespace eprosima |
204 | | |
205 | | #endif //_FASTDDS_RTPS_COMMON_WRITEPARAMS_H_ |