CARLA
PointCloud2.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 PointCloud2.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 "PointCloud2.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 sensor_msgs_msg_PointField_max_cdr_typesize 272ULL;
38 #define std_msgs_msg_Time_max_cdr_typesize 8ULL;
39 #define sensor_msgs_msg_PointCloud2_max_cdr_typesize 27597ULL;
40 #define std_msgs_msg_Header_max_cdr_typesize 268ULL;
41 #define sensor_msgs_msg_PointField_max_key_cdr_typesize 0ULL;
42 #define std_msgs_msg_Time_max_key_cdr_typesize 0ULL;
43 #define sensor_msgs_msg_PointCloud2_max_key_cdr_typesize 0ULL;
44 #define std_msgs_msg_Header_max_key_cdr_typesize 0ULL;
45 
47 {
48  // std_msgs::msg::Header m_header
49 
50  // unsigned long m_height
51  m_height = 0;
52  // unsigned long m_width
53  m_width = 0;
54  // sequence<sensor_msgs::msg::PointField> m_fields
55 
56  // boolean m_is_bigendian
57  m_is_bigendian = false;
58  // unsigned long m_point_step
59  m_point_step = 0;
60  // unsigned long m_row_step
61  m_row_step = 0;
62  // sequence<octet> m_data
63 
64  // boolean m_is_dense
65  m_is_dense = false;
66 }
67 
69 {
70 }
71 
73  const PointCloud2& x)
74 {
75  m_header = x.m_header;
76  m_height = x.m_height;
77  m_width = x.m_width;
78  m_fields = x.m_fields;
79  m_is_bigendian = x.m_is_bigendian;
80  m_point_step = x.m_point_step;
81  m_row_step = x.m_row_step;
82  m_data = x.m_data;
83  m_is_dense = x.m_is_dense;
84 }
85 
87  PointCloud2&& x) noexcept
88 {
89  m_header = std::move(x.m_header);
90  m_height = x.m_height;
91  m_width = x.m_width;
92  m_fields = std::move(x.m_fields);
93  m_is_bigendian = x.m_is_bigendian;
94  m_point_step = x.m_point_step;
95  m_row_step = x.m_row_step;
96  m_data = std::move(x.m_data);
97  m_is_dense = x.m_is_dense;
98 }
99 
101  const PointCloud2& x)
102 {
103  m_header = x.m_header;
104  m_height = x.m_height;
105  m_width = x.m_width;
106  m_fields = x.m_fields;
107  m_is_bigendian = x.m_is_bigendian;
108  m_point_step = x.m_point_step;
109  m_row_step = x.m_row_step;
110  m_data = x.m_data;
111  m_is_dense = x.m_is_dense;
112 
113  return *this;
114 }
115 
117  PointCloud2&& x) noexcept
118 {
119  m_header = std::move(x.m_header);
120  m_height = x.m_height;
121  m_width = x.m_width;
122  m_fields = std::move(x.m_fields);
123  m_is_bigendian = x.m_is_bigendian;
124  m_point_step = x.m_point_step;
125  m_row_step = x.m_row_step;
126  m_data = std::move(x.m_data);
127  m_is_dense = x.m_is_dense;
128 
129  return *this;
130 }
131 
133  const PointCloud2& x) const
134 {
135  return (m_header == x.m_header && m_height == x.m_height && m_width == x.m_width && m_fields == x.m_fields && m_is_bigendian == x.m_is_bigendian && m_point_step == x.m_point_step && m_row_step == x.m_row_step && m_data == x.m_data && m_is_dense == x.m_is_dense);
136 }
137 
139  const PointCloud2& x) const
140 {
141  return !(*this == x);
142 }
143 
145  size_t current_alignment)
146 {
147  static_cast<void>(current_alignment);
149 }
150 
152  const sensor_msgs::msg::PointCloud2& data,
153  size_t current_alignment)
154 {
155  size_t initial_alignment = current_alignment;
156  current_alignment += std_msgs::msg::Header::getCdrSerializedSize(data.header(), current_alignment);
157  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
158  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
159  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
160 
161  for(size_t a = 0; a < data.fields().size(); ++a)
162  {
163  current_alignment += sensor_msgs::msg::PointField::getCdrSerializedSize(data.fields().at(a), current_alignment);
164  }
165 
166  current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
167  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
168  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
169  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
170 
171  if (data.data().size() > 0)
172  {
173  current_alignment += (data.data().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
174  }
175 
176  current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
177 
178  return current_alignment - initial_alignment;
179 }
180 
182  eprosima::fastcdr::Cdr& scdr) const
183 {
184  scdr << m_header;
185  scdr << m_height;
186  scdr << m_width;
187  scdr << m_fields;
188  scdr << m_is_bigendian;
189  scdr << m_point_step;
190  scdr << m_row_step;
191  scdr << m_data;
192  scdr << m_is_dense;
193 }
194 
196  eprosima::fastcdr::Cdr& dcdr)
197 {
198  dcdr >> m_header;
199  dcdr >> m_height;
200  dcdr >> m_width;
201  dcdr >> m_fields;
202  dcdr >> m_is_bigendian;
203  dcdr >> m_point_step;
204  dcdr >> m_row_step;
205  dcdr >> m_data;
206  dcdr >> m_is_dense;
207 }
208 
209 /*!
210  * @brief This function copies the value in member header
211  * @param _header New value to be copied in member header
212  */
214  const std_msgs::msg::Header& _header)
215 {
216  m_header = _header;
217 }
218 
219 /*!
220  * @brief This function moves the value in member header
221  * @param _header New value to be moved in member header
222  */
224  std_msgs::msg::Header&& _header)
225 {
226  m_header = std::move(_header);
227 }
228 
229 /*!
230  * @brief This function returns a constant reference to member header
231  * @return Constant reference to member header
232  */
234 {
235  return m_header;
236 }
237 
238 /*!
239  * @brief This function returns a reference to member header
240  * @return Reference to member header
241  */
243 {
244  return m_header;
245 }
246 
247 /*!
248  * @brief This function sets a value in member height
249  * @param _height New value for member height
250  */
252  uint32_t _height)
253 {
254  m_height = _height;
255 }
256 
257 /*!
258  * @brief This function returns the value of member height
259  * @return Value of member height
260  */
262 {
263  return m_height;
264 }
265 
266 /*!
267  * @brief This function returns a reference to member height
268  * @return Reference to member height
269  */
271 {
272  return m_height;
273 }
274 
275 /*!
276  * @brief This function sets a value in member width
277  * @param _width New value for member width
278  */
280  uint32_t _width)
281 {
282  m_width = _width;
283 }
284 
285 /*!
286  * @brief This function returns the value of member width
287  * @return Value of member width
288  */
290 {
291  return m_width;
292 }
293 
294 /*!
295  * @brief This function returns a reference to member width
296  * @return Reference to member width
297  */
299 {
300  return m_width;
301 }
302 
303 /*!
304  * @brief This function copies the value in member fields
305  * @param _fields New value to be copied in member fields
306  */
308  const std::vector<sensor_msgs::msg::PointField>& _fields)
309 {
310  m_fields = _fields;
311 }
312 
313 /*!
314  * @brief This function moves the value in member fields
315  * @param _fields New value to be moved in member fields
316  */
318  std::vector<sensor_msgs::msg::PointField>&& _fields)
319 {
320  m_fields = std::move(_fields);
321 }
322 
323 /*!
324  * @brief This function returns a constant reference to member fields
325  * @return Constant reference to member fields
326  */
327 const std::vector<sensor_msgs::msg::PointField>& sensor_msgs::msg::PointCloud2::fields() const
328 {
329  return m_fields;
330 }
331 
332 /*!
333  * @brief This function returns a reference to member fields
334  * @return Reference to member fields
335  */
336 std::vector<sensor_msgs::msg::PointField>& sensor_msgs::msg::PointCloud2::fields()
337 {
338  return m_fields;
339 }
340 
341 /*!
342  * @brief This function sets a value in member is_bigendian
343  * @param _is_bigendian New value for member is_bigendian
344  */
346  bool _is_bigendian)
347 {
348  m_is_bigendian = _is_bigendian;
349 }
350 
351 /*!
352  * @brief This function returns the value of member is_bigendian
353  * @return Value of member is_bigendian
354  */
356 {
357  return m_is_bigendian;
358 }
359 
360 /*!
361  * @brief This function returns a reference to member is_bigendian
362  * @return Reference to member is_bigendian
363  */
365 {
366  return m_is_bigendian;
367 }
368 
369 /*!
370  * @brief This function sets a value in member point_step
371  * @param _point_step New value for member point_step
372  */
374  uint32_t _point_step)
375 {
376  m_point_step = _point_step;
377 }
378 
379 /*!
380  * @brief This function returns the value of member point_step
381  * @return Value of member point_step
382  */
384 {
385  return m_point_step;
386 }
387 
388 /*!
389  * @brief This function returns a reference to member point_step
390  * @return Reference to member point_step
391  */
393 {
394  return m_point_step;
395 }
396 
397 /*!
398  * @brief This function sets a value in member row_step
399  * @param _row_step New value for member row_step
400  */
402  uint32_t _row_step)
403 {
404  m_row_step = _row_step;
405 }
406 
407 /*!
408  * @brief This function returns the value of member row_step
409  * @return Value of member row_step
410  */
412 {
413  return m_row_step;
414 }
415 
416 /*!
417  * @brief This function returns a reference to member row_step
418  * @return Reference to member row_step
419  */
421 {
422  return m_row_step;
423 }
424 
425 /*!
426  * @brief This function copies the value in member data
427  * @param _data New value to be copied in member data
428  */
430  const std::vector<uint8_t>& _data)
431 {
432  m_data = _data;
433 }
434 
435 /*!
436  * @brief This function moves the value in member data
437  * @param _data New value to be moved in member data
438  */
440  std::vector<uint8_t>&& _data)
441 {
442  m_data = std::move(_data);
443 }
444 
445 /*!
446  * @brief This function returns a constant reference to member data
447  * @return Constant reference to member data
448  */
449 const std::vector<uint8_t>& sensor_msgs::msg::PointCloud2::data() const
450 {
451  return m_data;
452 }
453 
454 /*!
455  * @brief This function returns a reference to member data
456  * @return Reference to member data
457  */
458 std::vector<uint8_t>& sensor_msgs::msg::PointCloud2::data()
459 {
460  return m_data;
461 }
462 
463 /*!
464  * @brief This function sets a value in member is_dense
465  * @param _is_dense New value for member is_dense
466  */
468  bool _is_dense)
469 {
470  m_is_dense = _is_dense;
471 }
472 
473 /*!
474  * @brief This function returns the value of member is_dense
475  * @return Value of member is_dense
476  */
478 {
479  return m_is_dense;
480 }
481 
482 /*!
483  * @brief This function returns a reference to member is_dense
484  * @return Reference to member is_dense
485  */
487 {
488  return m_is_dense;
489 }
490 
492  size_t current_alignment)
493 {
494  static_cast<void>(current_alignment);
496 }
497 
499 {
500  return false;
501 }
502 
504  eprosima::fastcdr::Cdr& scdr) const
505 {
506  (void) scdr;
507 }
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::PointCloud2 &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
eProsima_user_DllExport PointCloud2 & operator=(const PointCloud2 &x)
Copy assignment.
This class represents the structure PointCloud2 defined by the user in the IDL file.
Definition: PointCloud2.h:73
eProsima_user_DllExport uint32_t width() const
This function returns the value of member width.
eProsima_user_DllExport bool operator==(const PointCloud2 &x) const
Comparison operator.
eProsima_user_DllExport const std_msgs::msg::Header & header() const
This function returns a constant reference to member header.
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::PointField &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: PointField.cpp:115
This class represents the structure Header defined by the user in the IDL file.
Definition: Header.h:72
eProsima_user_DllExport PointCloud2()
Default constructor.
Definition: PointCloud2.cpp:46
eProsima_user_DllExport uint32_t height() const
This function returns the value of member height.
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
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
eProsima_user_DllExport void header(const std_msgs::msg::Header &_header)
This function copies the value in member header.
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
std::vector< sensor_msgs::msg::PointField > m_fields
Definition: PointCloud2.h:376
eProsima_user_DllExport bool operator!=(const PointCloud2 &x) const
Comparison operator.
eProsima_user_DllExport uint32_t row_step() const
This function returns the value of member row_step.
eProsima_user_DllExport bool is_bigendian() const
This function returns the value of member is_bigendian.
eProsima_user_DllExport void data(const std::vector< uint8_t > &_data)
This function copies the value in member data.
eProsima_user_DllExport const std::vector< sensor_msgs::msg::PointField > & fields() const
This function returns a constant reference to member fields.
#define sensor_msgs_msg_PointCloud2_max_cdr_typesize
Definition: PointCloud2.cpp:39
std::vector< uint8_t > m_data
Definition: PointCloud2.h:380
eProsima_user_DllExport ~PointCloud2()
Default destructor.
Definition: PointCloud2.cpp:68
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...
eProsima_user_DllExport uint32_t point_step() const
This function returns the value of member point_step.
std_msgs::msg::Header m_header
Definition: PointCloud2.h:373
eProsima_user_DllExport void fields(const std::vector< sensor_msgs::msg::PointField > &_fields)
This function copies the value in member fields.
eProsima_user_DllExport bool is_dense() const
This function returns the value of member is_dense.
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
#define sensor_msgs_msg_PointCloud2_max_key_cdr_typesize
Definition: PointCloud2.cpp:43
eProsima_user_DllExport const std::vector< uint8_t > & data() const
This function returns a constant reference to member data.
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...