CARLA
PointField.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 PointField.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 "PointField.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 sensor_msgs_msg_PointField_max_key_cdr_typesize 0ULL;
39 
41 {
42  // string m_name
43  m_name ="";
44  // unsigned long m_offset
45  m_offset = 0;
46  // octet m_datatype
47  m_datatype = 0;
48  // unsigned long m_count
49  m_count = 0;
50 }
51 
53 {
54 }
55 
57  const PointField& x)
58 {
59  m_name = x.m_name;
60  m_offset = x.m_offset;
61  m_datatype = x.m_datatype;
62  m_count = x.m_count;
63 }
64 
66  PointField&& x) noexcept
67 {
68  m_name = std::move(x.m_name);
69  m_offset = x.m_offset;
70  m_datatype = x.m_datatype;
71  m_count = x.m_count;
72 }
73 
75  const PointField& x)
76 {
77  m_name = x.m_name;
78  m_offset = x.m_offset;
79  m_datatype = x.m_datatype;
80  m_count = x.m_count;
81 
82  return *this;
83 }
84 
86  PointField&& x) noexcept
87 {
88  m_name = std::move(x.m_name);
89  m_offset = x.m_offset;
90  m_datatype = x.m_datatype;
91  m_count = x.m_count;
92 
93  return *this;
94 }
95 
97  const PointField& x) const
98 {
99  return (m_name == x.m_name && m_offset == x.m_offset && m_datatype == x.m_datatype && m_count == x.m_count);
100 }
101 
103  const PointField& x) const
104 {
105  return !(*this == x);
106 }
107 
109  size_t current_alignment)
110 {
111  static_cast<void>(current_alignment);
113 }
114 
116  const sensor_msgs::msg::PointField& data,
117  size_t current_alignment)
118 {
119  size_t initial_alignment = current_alignment;
120  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1;
121  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
122  current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
123  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
124 
125  return current_alignment - initial_alignment;
126 }
127 
129  eprosima::fastcdr::Cdr& scdr) const
130 {
131  scdr << m_name.c_str();
132  scdr << m_offset;
133  scdr << m_datatype;
134  scdr << m_count;
135 }
136 
138  eprosima::fastcdr::Cdr& dcdr)
139 {
140  dcdr >> m_name;
141  dcdr >> m_offset;
142  dcdr >> m_datatype;
143  dcdr >> m_count;
144 }
145 
146 /*!
147  * @brief This function copies the value in member name
148  * @param _name New value to be copied in member name
149  */
151  const std::string& _name)
152 {
153  m_name = _name;
154 }
155 
156 /*!
157  * @brief This function moves the value in member name
158  * @param _name New value to be moved in member name
159  */
161  std::string&& _name)
162 {
163  m_name = std::move(_name);
164 }
165 
166 /*!
167  * @brief This function returns a constant reference to member name
168  * @return Constant reference to member name
169  */
170 const std::string& sensor_msgs::msg::PointField::name() const
171 {
172  return m_name;
173 }
174 
175 /*!
176  * @brief This function returns a reference to member name
177  * @return Reference to member name
178  */
180 {
181  return m_name;
182 }
183 
184 /*!
185  * @brief This function sets a value in member offset
186  * @param _offset New value for member offset
187  */
189  uint32_t _offset)
190 {
191  m_offset = _offset;
192 }
193 
194 /*!
195  * @brief This function returns the value of member offset
196  * @return Value of member offset
197  */
199 {
200  return m_offset;
201 }
202 
203 /*!
204  * @brief This function returns a reference to member offset
205  * @return Reference to member offset
206  */
208 {
209  return m_offset;
210 }
211 
212 /*!
213  * @brief This function sets a value in member datatype
214  * @param _datatype New value for member datatype
215  */
217  uint8_t _datatype)
218 {
219  m_datatype = _datatype;
220 }
221 
222 /*!
223  * @brief This function returns the value of member datatype
224  * @return Value of member datatype
225  */
227 {
228  return m_datatype;
229 }
230 
231 /*!
232  * @brief This function returns a reference to member datatype
233  * @return Reference to member datatype
234  */
236 {
237  return m_datatype;
238 }
239 
240 /*!
241  * @brief This function sets a value in member count
242  * @param _count New value for member count
243  */
245  uint32_t _count)
246 {
247  m_count = _count;
248 }
249 
250 /*!
251  * @brief This function returns the value of member count
252  * @return Value of member count
253  */
255 {
256  return m_count;
257 }
258 
259 /*!
260  * @brief This function returns a reference to member count
261  * @return Reference to member count
262  */
264 {
265  return m_count;
266 }
267 
269  size_t current_alignment)
270 {
271  static_cast<void>(current_alignment);
273 }
274 
276 {
277  return false;
278 }
279 
281  eprosima::fastcdr::Cdr& scdr) const
282 {
283  (void) scdr;
284 }
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: PointField.cpp:275
eProsima_user_DllExport const std::string & name() const
This function returns a constant reference to member name.
Definition: PointField.cpp:170
eProsima_user_DllExport bool operator!=(const PointField &x) const
Comparison operator.
Definition: PointField.cpp:102
This class represents the structure PointField defined by the user in the IDL file.
Definition: PointField.h:79
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
eProsima_user_DllExport void name(const std::string &_name)
This function copies the value in member name.
Definition: PointField.cpp:150
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: PointField.cpp:268
eProsima_user_DllExport uint8_t datatype() const
This function returns the value of member datatype.
Definition: PointField.cpp:226
eProsima_user_DllExport uint32_t count() const
This function returns the value of member count.
Definition: PointField.cpp:254
#define sensor_msgs_msg_PointField_max_cdr_typesize
Definition: PointField.cpp:37
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: PointField.cpp:280
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: PointField.cpp:137
eProsima_user_DllExport PointField & operator=(const PointField &x)
Copy assignment.
Definition: PointField.cpp:74
eProsima_user_DllExport bool operator==(const PointField &x) const
Comparison operator.
Definition: PointField.cpp:96
eProsima_user_DllExport PointField()
Default constructor.
Definition: PointField.cpp:40
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: PointField.cpp:108
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: PointField.cpp:128
eProsima_user_DllExport uint32_t offset() const
This function returns the value of member offset.
Definition: PointField.cpp:198
#define sensor_msgs_msg_PointField_max_key_cdr_typesize
Definition: PointField.cpp:38
eProsima_user_DllExport ~PointField()
Default destructor.
Definition: PointField.cpp:52