CARLA
Odometry.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 Odometry.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 "Odometry.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 geometry_msgs_msg_TwistWithCovariance_max_cdr_typesize 336ULL;
38 #define geometry_msgs_msg_Vector3_max_cdr_typesize 24ULL;
39 #define geometry_msgs_msg_Pose_max_cdr_typesize 56ULL;
40 #define std_msgs_msg_Time_max_cdr_typesize 8ULL;
41 #define nav_msgs_msg_Odometry_max_cdr_typesize 1208ULL;
42 #define geometry_msgs_msg_Twist_max_cdr_typesize 48ULL;
43 #define geometry_msgs_msg_Point_max_cdr_typesize 24ULL;
44 #define geometry_msgs_msg_PoseWithCovariance_max_cdr_typesize 344ULL;
45 #define geometry_msgs_msg_Quaternion_max_cdr_typesize 32ULL;
46 #define std_msgs_msg_Header_max_cdr_typesize 268ULL;
47 #define geometry_msgs_msg_TwistWithCovariance_max_key_cdr_typesize 0ULL;
48 #define geometry_msgs_msg_Vector3_max_key_cdr_typesize 0ULL;
49 #define geometry_msgs_msg_Pose_max_key_cdr_typesize 0ULL;
50 #define std_msgs_msg_Time_max_key_cdr_typesize 0ULL;
51 #define nav_msgs_msg_Odometry_max_key_cdr_typesize 0ULL;
52 #define geometry_msgs_msg_Twist_max_key_cdr_typesize 0ULL;
53 #define geometry_msgs_msg_Point_max_key_cdr_typesize 0ULL;
54 #define geometry_msgs_msg_PoseWithCovariance_max_key_cdr_typesize 0ULL;
55 #define geometry_msgs_msg_Quaternion_max_key_cdr_typesize 0ULL;
56 #define std_msgs_msg_Header_max_key_cdr_typesize 0ULL;
57 
59 {
60  // std_msgs::msg::Header m_header
61 
62  // string m_child_frame_id
63  m_child_frame_id ="";
64  // geometry_msgs::msg::PoseWithCovariance m_pose
65 
66  // geometry_msgs::msg::TwistWithCovariance m_twist
67 }
68 
70 {
71 }
72 
74  const Odometry& x)
75 {
76  m_header = x.m_header;
77  m_child_frame_id = x.m_child_frame_id;
78  m_pose = x.m_pose;
79  m_twist = x.m_twist;
80 }
81 
83  Odometry&& x) noexcept
84 {
85  m_header = std::move(x.m_header);
86  m_child_frame_id = std::move(x.m_child_frame_id);
87  m_pose = std::move(x.m_pose);
88  m_twist = std::move(x.m_twist);
89 }
90 
92  const Odometry& x)
93 {
94  m_header = x.m_header;
95  m_child_frame_id = x.m_child_frame_id;
96  m_pose = x.m_pose;
97  m_twist = x.m_twist;
98 
99  return *this;
100 }
101 
103  Odometry&& x) noexcept
104 {
105  m_header = std::move(x.m_header);
106  m_child_frame_id = std::move(x.m_child_frame_id);
107  m_pose = std::move(x.m_pose);
108  m_twist = std::move(x.m_twist);
109 
110  return *this;
111 }
112 
114  const Odometry& x) const
115 {
116  return (m_header == x.m_header && m_child_frame_id == x.m_child_frame_id && m_pose == x.m_pose && m_twist == x.m_twist);
117 }
118 
120  const Odometry& x) const
121 {
122  return !(*this == x);
123 }
124 
126  size_t current_alignment)
127 {
128  static_cast<void>(current_alignment);
130 }
131 
133  const nav_msgs::msg::Odometry& data,
134  size_t current_alignment)
135 {
136  size_t initial_alignment = current_alignment;
137  current_alignment += std_msgs::msg::Header::getCdrSerializedSize(data.header(), current_alignment);
138  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.child_frame_id().size() + 1;
139  current_alignment += geometry_msgs::msg::PoseWithCovariance::getCdrSerializedSize(data.pose(), current_alignment);
140  current_alignment += geometry_msgs::msg::TwistWithCovariance::getCdrSerializedSize(data.twist(), current_alignment);
141 
142  return current_alignment - initial_alignment;
143 }
144 
146  eprosima::fastcdr::Cdr& scdr) const
147 {
148  scdr << m_header;
149  scdr << m_child_frame_id.c_str();
150  scdr << m_pose;
151  scdr << m_twist;
152 }
153 
155  eprosima::fastcdr::Cdr& dcdr)
156 {
157  dcdr >> m_header;
158  dcdr >> m_child_frame_id;
159  dcdr >> m_pose;
160  dcdr >> m_twist;
161 }
162 
163 /*!
164  * @brief This function copies the value in member header
165  * @param _header New value to be copied in member header
166  */
168  const std_msgs::msg::Header& _header)
169 {
170  m_header = _header;
171 }
172 
173 /*!
174  * @brief This function moves the value in member header
175  * @param _header New value to be moved in member header
176  */
178  std_msgs::msg::Header&& _header)
179 {
180  m_header = std::move(_header);
181 }
182 
183 /*!
184  * @brief This function returns a constant reference to member header
185  * @return Constant reference to member header
186  */
188 {
189  return m_header;
190 }
191 
192 /*!
193  * @brief This function returns a reference to member header
194  * @return Reference to member header
195  */
197 {
198  return m_header;
199 }
200 /*!
201  * @brief This function copies the value in member child_frame_id
202  * @param _child_frame_id New value to be copied in member child_frame_id
203  */
205  const std::string& _child_frame_id)
206 {
207  m_child_frame_id = _child_frame_id;
208 }
209 
210 /*!
211  * @brief This function moves the value in member child_frame_id
212  * @param _child_frame_id New value to be moved in member child_frame_id
213  */
215  std::string&& _child_frame_id)
216 {
217  m_child_frame_id = std::move(_child_frame_id);
218 }
219 
220 /*!
221  * @brief This function returns a constant reference to member child_frame_id
222  * @return Constant reference to member child_frame_id
223  */
224 const std::string& nav_msgs::msg::Odometry::child_frame_id() const
225 {
226  return m_child_frame_id;
227 }
228 
229 /*!
230  * @brief This function returns a reference to member child_frame_id
231  * @return Reference to member child_frame_id
232  */
234 {
235  return m_child_frame_id;
236 }
237 
238 /*!
239  * @brief This function copies the value in member pose
240  * @param _pose New value to be copied in member pose
241  */
244 {
245  m_pose = _pose;
246 }
247 
248 /*!
249  * @brief This function moves the value in member pose
250  * @param _pose New value to be moved in member pose
251  */
254 {
255  m_pose = std::move(_pose);
256 }
257 
258 /*!
259  * @brief This function returns a constant reference to member pose
260  * @return Constant reference to member pose
261  */
263 {
264  return m_pose;
265 }
266 
267 /*!
268  * @brief This function returns a reference to member pose
269  * @return Reference to member pose
270  */
272 {
273  return m_pose;
274 }
275 
276 /*!
277  * @brief This function copies the value in member twist
278  * @param _twist New value to be copied in member twist
279  */
282 {
283  m_twist = _twist;
284 }
285 
286 /*!
287  * @brief This function moves the value in member twist
288  * @param _twist New value to be moved in member twist
289  */
292 {
293  m_twist = std::move(_twist);
294 }
295 
296 /*!
297  * @brief This function returns a constant reference to member twist
298  * @return Constant reference to member twist
299  */
301 {
302  return m_twist;
303 }
304 
305 /*!
306  * @brief This function returns a reference to member twist
307  * @return Reference to member twist
308  */
310 {
311  return m_twist;
312 }
313 
315  size_t current_alignment)
316 {
317  static_cast<void>(current_alignment);
319 }
320 
322 {
323  return false;
324 }
325 
327  eprosima::fastcdr::Cdr& scdr) const
328 {
329  (void) scdr;
330 }
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Odometry.cpp:145
geometry_msgs::msg::TwistWithCovariance m_twist
Definition: Odometry.h:289
eProsima_user_DllExport Odometry()
Default constructor.
Definition: Odometry.cpp:58
eProsima_user_DllExport bool operator==(const Odometry &x) const
Comparison operator.
Definition: Odometry.cpp:113
This class represents the structure TwistWithCovariance defined by the user in the IDL file...
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: Odometry.cpp:125
eProsima_user_DllExport const geometry_msgs::msg::TwistWithCovariance & twist() const
This function returns a constant reference to member twist.
Definition: Odometry.cpp:300
eProsima_user_DllExport bool operator!=(const Odometry &x) const
Comparison operator.
Definition: Odometry.cpp:119
std::string m_child_frame_id
Definition: Odometry.h:287
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Odometry.cpp:321
eProsima_user_DllExport const std_msgs::msg::Header & header() const
This function returns a constant reference to member header.
Definition: Odometry.cpp:187
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Odometry.cpp:154
eProsima_user_DllExport void twist(const geometry_msgs::msg::TwistWithCovariance &_twist)
This function copies the value in member twist.
Definition: Odometry.cpp:280
This class represents the structure Header defined by the user in the IDL file.
Definition: Header.h:72
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 size_t getCdrSerializedSize(const geometry_msgs::msg::PoseWithCovariance &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
#define nav_msgs_msg_Odometry_max_key_cdr_typesize
Definition: Odometry.cpp:51
This class represents the structure PoseWithCovariance defined by the user in the IDL file...
static eProsima_user_DllExport size_t getCdrSerializedSize(const nav_msgs::msg::Odometry &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Odometry.cpp:132
geometry_msgs::msg::PoseWithCovariance m_pose
Definition: Odometry.h:288
eProsima_user_DllExport void header(const std_msgs::msg::Header &_header)
This function copies the value in member header.
Definition: Odometry.cpp:167
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Odometry.cpp:326
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: Odometry.cpp:314
eProsima_user_DllExport Odometry & operator=(const Odometry &x)
Copy assignment.
Definition: Odometry.cpp:91
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::TwistWithCovariance &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
eProsima_user_DllExport const geometry_msgs::msg::PoseWithCovariance & pose() const
This function returns a constant reference to member pose.
Definition: Odometry.cpp:262
std_msgs::msg::Header m_header
Definition: Odometry.h:286
#define nav_msgs_msg_Odometry_max_cdr_typesize
Definition: Odometry.cpp:41
eProsima_user_DllExport void pose(const geometry_msgs::msg::PoseWithCovariance &_pose)
This function copies the value in member pose.
Definition: Odometry.cpp:242
eProsima_user_DllExport void child_frame_id(const std::string &_child_frame_id)
This function copies the value in member child_frame_id.
Definition: Odometry.cpp:204
eProsima_user_DllExport ~Odometry()
Default destructor.
Definition: Odometry.cpp:69
This class represents the structure Odometry defined by the user in the IDL file. ...
Definition: Odometry.h:74
eProsima_user_DllExport const std::string & child_frame_id() const
This function returns a constant reference to member child_frame_id.
Definition: Odometry.cpp:224