CARLA
Image.cpp
Go to the documentation of this file.
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 Image.cpp
17  * This source file contains the definition of the described types in the IDL file.
18  *
19  * This file was generated by the tool gen.
20  */
21 
22 #ifdef _WIN32
23 // Remove linker warning LNK4221 on Visual Studio
24 namespace {
25 char dummy;
26 } // namespace
27 #endif // _WIN32
28 
29 #include "Image.h"
30 #include <fastcdr/Cdr.h>
31 
32 #include <fastcdr/exceptions/BadParamException.h>
33 using namespace eprosima::fastcdr::exception;
34 
35 #include <utility>
36 
37 #define builtin_interfaces_msg_Time_max_cdr_typesize 8ULL;
38 #define sensor_msgs_msg_Image_max_cdr_typesize 648ULL;
39 #define std_msgs_msg_Header_max_cdr_typesize 268ULL;
40 #define builtin_interfaces_msg_Time_max_key_cdr_typesize 0ULL;
41 #define sensor_msgs_msg_Image_max_key_cdr_typesize 0ULL;
42 #define std_msgs_msg_Header_max_key_cdr_typesize 0ULL;
43 
45 {
46  // std_msgs::msg::Header m_header
47 
48  // unsigned long m_height
49  m_height = 0;
50  // unsigned long m_width
51  m_width = 0;
52  // string m_encoding
53  m_encoding ="";
54  // uint8 m_is_bigendian
55  m_is_bigendian = 0;
56  // unsigned long m_step
57  m_step = 0;
58  // sequence<uint8> m_data
59 }
60 
62 {
63 }
64 
66  const Image& x)
67 {
68  m_header = x.m_header;
69  m_height = x.m_height;
70  m_width = x.m_width;
71  m_encoding = x.m_encoding;
72  m_is_bigendian = x.m_is_bigendian;
73  m_step = x.m_step;
74  m_data = x.m_data;
75 }
76 
78  Image&& x) noexcept
79 {
80  m_header = std::move(x.m_header);
81  m_height = x.m_height;
82  m_width = x.m_width;
83  m_encoding = std::move(x.m_encoding);
84  m_is_bigendian = x.m_is_bigendian;
85  m_step = x.m_step;
86  m_data = std::move(x.m_data);
87 }
88 
90  const Image& x)
91 {
92  m_header = x.m_header;
93  m_height = x.m_height;
94  m_width = x.m_width;
95  m_encoding = x.m_encoding;
96  m_is_bigendian = x.m_is_bigendian;
97  m_step = x.m_step;
98  m_data = x.m_data;
99 
100  return *this;
101 }
102 
104  Image&& x) noexcept
105 {
106  m_header = std::move(x.m_header);
107  m_height = x.m_height;
108  m_width = x.m_width;
109  m_encoding = std::move(x.m_encoding);
110  m_is_bigendian = x.m_is_bigendian;
111  m_step = x.m_step;
112  m_data = std::move(x.m_data);
113 
114  return *this;
115 }
116 
118  const Image& x) const
119 {
120  return (m_header == x.m_header && m_height == x.m_height && m_width == x.m_width && m_encoding == x.m_encoding && m_is_bigendian == x.m_is_bigendian && m_step == x.m_step && m_data == x.m_data);
121 }
122 
124  const Image& x) const
125 {
126  return !(*this == x);
127 }
128 
130  size_t current_alignment)
131 {
132  static_cast<void>(current_alignment);
134 }
135 
137  const sensor_msgs::msg::Image& data,
138  size_t current_alignment)
139 {
140  size_t initial_alignment = current_alignment;
141  current_alignment += std_msgs::msg::Header::getCdrSerializedSize(data.header(), current_alignment);
142  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
143  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
144  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.encoding().size() + 1;
145  current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
146  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
147  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
148 
149  if (data.data().size() > 0)
150  {
151  current_alignment += (data.data().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
152  }
153 
154  return current_alignment - initial_alignment;
155 }
156 
158  eprosima::fastcdr::Cdr& scdr) const
159 {
160  scdr << m_header;
161  scdr << m_height;
162  scdr << m_width;
163  scdr << m_encoding.c_str();
164  scdr << m_is_bigendian;
165  scdr << m_step;
166  scdr << m_data;
167 }
168 
170  eprosima::fastcdr::Cdr& dcdr)
171 {
172  dcdr >> m_header;
173  dcdr >> m_height;
174  dcdr >> m_width;
175  dcdr >> m_encoding;
176  dcdr >> m_is_bigendian;
177  dcdr >> m_step;
178  dcdr >> m_data;
179 }
180 
181 /*!
182  * @brief This function copies the value in member header
183  * @param _header New value to be copied in member header
184  */
186  const std_msgs::msg::Header& _header)
187 {
188  m_header = _header;
189 }
190 
191 /*!
192  * @brief This function moves the value in member header
193  * @param _header New value to be moved in member header
194  */
196  std_msgs::msg::Header&& _header)
197 {
198  m_header = std::move(_header);
199 }
200 
201 /*!
202  * @brief This function returns a constant reference to member header
203  * @return Constant reference to member header
204  */
206 {
207  return m_header;
208 }
209 
210 /*!
211  * @brief This function returns a reference to member header
212  * @return Reference to member header
213  */
215 {
216  return m_header;
217 }
218 
219 /*!
220  * @brief This function sets a value in member height
221  * @param _height New value for member height
222  */
224  uint32_t _height)
225 {
226  m_height = _height;
227 }
228 
229 /*!
230  * @brief This function returns the value of member height
231  * @return Value of member height
232  */
234 {
235  return m_height;
236 }
237 
238 /*!
239  * @brief This function returns a reference to member height
240  * @return Reference to member height
241  */
243 {
244  return m_height;
245 }
246 
247 /*!
248  * @brief This function sets a value in member width
249  * @param _width New value for member width
250  */
252  uint32_t _width)
253 {
254  m_width = _width;
255 }
256 
257 /*!
258  * @brief This function returns the value of member width
259  * @return Value of member width
260  */
262 {
263  return m_width;
264 }
265 
266 /*!
267  * @brief This function returns a reference to member width
268  * @return Reference to member width
269  */
271 {
272  return m_width;
273 }
274 
275 /*!
276  * @brief This function copies the value in member encoding
277  * @param _encoding New value to be copied in member encoding
278  */
280  const std::string& _encoding)
281 {
282  m_encoding = _encoding;
283 }
284 
285 /*!
286  * @brief This function moves the value in member encoding
287  * @param _encoding New value to be moved in member encoding
288  */
290  std::string&& _encoding)
291 {
292  m_encoding = std::move(_encoding);
293 }
294 
295 /*!
296  * @brief This function returns a constant reference to member encoding
297  * @return Constant reference to member encoding
298  */
299 const std::string& sensor_msgs::msg::Image::encoding() const
300 {
301  return m_encoding;
302 }
303 
304 /*!
305  * @brief This function returns a reference to member encoding
306  * @return Reference to member encoding
307  */
309 {
310  return m_encoding;
311 }
312 
313 /*!
314  * @brief This function sets a value in member is_bigendian
315  * @param _is_bigendian New value for member is_bigendian
316  */
318  uint8_t _is_bigendian)
319 {
320  m_is_bigendian = _is_bigendian;
321 }
322 
323 /*!
324  * @brief This function returns the value of member is_bigendian
325  * @return Value of member is_bigendian
326  */
328 {
329  return m_is_bigendian;
330 }
331 
332 /*!
333  * @brief This function returns a reference to member is_bigendian
334  * @return Reference to member is_bigendian
335  */
337 {
338  return m_is_bigendian;
339 }
340 
341 /*!
342  * @brief This function sets a value in member step
343  * @param _step New value for member step
344  */
346  uint32_t _step)
347 {
348  m_step = _step;
349 }
350 
351 /*!
352  * @brief This function returns the value of member step
353  * @return Value of member step
354  */
356 {
357  return m_step;
358 }
359 
360 /*!
361  * @brief This function returns a reference to member step
362  * @return Reference to member step
363  */
365 {
366  return m_step;
367 }
368 
369 /*!
370  * @brief This function copies the value in member data
371  * @param _data New value to be copied in member data
372  */
374  const std::vector<uint8_t>& _data)
375 {
376  m_data = _data;
377 }
378 
379 /*!
380  * @brief This function moves the value in member data
381  * @param _data New value to be moved in member data
382  */
384  std::vector<uint8_t>&& _data)
385 {
386  m_data = std::move(_data);
387 }
388 
389 /*!
390  * @brief This function returns a constant reference to member data
391  * @return Constant reference to member data
392  */
393 const std::vector<uint8_t>& sensor_msgs::msg::Image::data() const
394 {
395  return m_data;
396 }
397 
398 /*!
399  * @brief This function returns a reference to member data
400  * @return Reference to member data
401  */
402 std::vector<uint8_t>& sensor_msgs::msg::Image::data()
403 {
404  return m_data;
405 }
406 
408  size_t current_alignment)
409 {
410  static_cast<void>(current_alignment);
412 }
413 
415 {
416  return false;
417 }
418 
420  eprosima::fastcdr::Cdr& scdr) const
421 {
422  (void) scdr;
423 }
eProsima_user_DllExport uint32_t width() const
This function returns the value of member width.
Definition: Image.cpp:261
eProsima_user_DllExport void encoding(const std::string &_encoding)
This function copies the value in member encoding.
Definition: Image.cpp:279
#define sensor_msgs_msg_Image_max_cdr_typesize
Definition: Image.cpp:38
eProsima_user_DllExport void header(const std_msgs::msg::Header &_header)
This function copies the value in member header.
Definition: Image.cpp:185
eProsima_user_DllExport const std::vector< uint8_t > & data() const
This function returns a constant reference to member data.
Definition: Image.cpp:393
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of the Key of an object depending on the buffer ali...
Definition: Image.cpp:407
eProsima_user_DllExport void data(const std::vector< uint8_t > &_data)
This function copies the value in member data.
Definition: Image.cpp:373
eProsima_user_DllExport bool operator==(const Image &x) const
Comparison operator.
Definition: Image.cpp:117
std_msgs::msg::Header m_header
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Image.cpp:169
eProsima_user_DllExport Image()
Default constructor.
Definition: Image.cpp:44
eProsima_user_DllExport ~Image()
Default destructor.
Definition: Image.cpp:61
std::vector< uint8_t > m_data
This class represents the structure Header defined by the user in the IDL file.
Definition: Header.h:72
eProsima_user_DllExport bool operator!=(const Image &x) const
Comparison operator.
Definition: Image.cpp:123
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of an object depending on the buffer alignment...
Definition: Image.cpp:129
eProsima_user_DllExport uint8_t is_bigendian() const
This function returns the value of member is_bigendian.
Definition: Image.cpp:327
This class represents the structure Image defined by the user in the IDL file.
static eProsima_user_DllExport size_t getCdrSerializedSize(const std_msgs::msg::Header &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Header.cpp:102
#define sensor_msgs_msg_Image_max_key_cdr_typesize
Definition: Image.cpp:41
eProsima_user_DllExport const std::string & encoding() const
This function returns a constant reference to member encoding.
Definition: Image.cpp:299
eProsima_user_DllExport uint32_t height() const
This function returns the value of member height.
Definition: Image.cpp:233
eProsima_user_DllExport const std_msgs::msg::Header & header() const
This function returns a constant reference to member header.
Definition: Image.cpp:205
eProsima_user_DllExport uint32_t step() const
This function returns the value of member step.
Definition: Image.cpp:355
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::Image &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Image.cpp:136
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Image.cpp:419
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Image.cpp:414
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Image.cpp:157
eProsima_user_DllExport Image & operator=(const Image &x)
Copy assignment.
Definition: Image.cpp:89