CARLA
 
载入中...
搜索中...
未找到
Pose.cpp
浏览该文件的文档.
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 Pose.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
24namespace {
25char dummy;
26} // namespace
27#endif // _WIN32
28
29#include "Pose.h"
30#include <fastcdr/Cdr.h>
31
32#include <fastcdr/exceptions/BadParamException.h>
33using namespace eprosima::fastcdr::exception;
34
35#include <utility>
36
37#define geometry_msgs_msg_Pose_max_cdr_typesize 56ULL;
38#define geometry_msgs_msg_Point_max_cdr_typesize 24ULL;
39#define geometry_msgs_msg_Quaternion_max_cdr_typesize 32ULL;
40#define geometry_msgs_msg_Pose_max_key_cdr_typesize 0ULL;
41#define geometry_msgs_msg_Point_max_key_cdr_typesize 0ULL;
42#define geometry_msgs_msg_Quaternion_max_key_cdr_typesize 0ULL;
43// 定义geometry_msgs::msg::Pose类的默认构造函数,目前函数体为空,可能用于创建一个默认初始化的Pose对象
47// 定义geometry_msgs::msg::Pose类的析构函数,函数体为空,通常用于释放该类对象占用的资源等相关清理工作
51// 定义geometry_msgs::msg::Pose类的拷贝构造函数
52// 参数x是一个const引用,表示要拷贝的另一个Pose对象
53// 函数的作用是将传入的Pose对象x的成员变量m_position和m_orientation的值拷贝到当前正在创建的对象中
55 const Pose& x)
56{
57 m_position = x.m_position;
58 m_orientation = x.m_orientation;
59}
60// 定义geometry_msgs::msg::Pose类的移动构造函数
61// 参数x是一个右值引用,用于实现资源的转移(避免不必要的拷贝),noexcept表示该函数不会抛出异常
62// 函数的作用是将传入的右值引用对象x的成员变量m_position和m_orientation通过移动语义进行转移到当前正在创建的对象中
64 Pose&& x) noexcept
65{
66 m_position = std::move(x.m_position);
67 m_orientation = std::move(x.m_orientation);
68}
69// 定义geometry_msgs::msg::Pose类的拷贝赋值运算符重载函数
70// 参数x是一个const引用,表示要赋值的另一个Pose对象
71// 函数将对象x的成员变量m_position和m_orientation的值赋给当前对象的相应成员变量,并返回当前对象的引用,以支持连续赋值操作
73 const Pose& x)
74{
75 m_position = x.m_position;
76 m_orientation = x.m_orientation;
77
78 return *this;
79}
80// 定义geometry_msgs::msg::Pose类的移动赋值运算符重载函数
81// 参数x是一个右值引用,用于通过移动语义实现资源的转移赋值,noexcept表示不会抛出异常
82// 函数将右值引用对象x的成员变量m_position和m_orientation移动到当前对象的相应成员变量中,并返回当前对象的引用,支持连续赋值操作
84 Pose&& x) noexcept
85{
86 m_position = std::move(x.m_position);
87 m_orientation = std::move(x.m_orientation);
88
89 return *this;
90}
91// 定义geometry_msgs::msg::Pose类的相等运算符重载函数
92// 参数x是一个const引用,表示要与之比较的另一个Pose对象
93// 函数通过比较两个对象的成员变量m_position和m_orientation是否相等,来判断两个Pose对象是否相等,返回比较结果(true或false)
95 const Pose& x) const
96{
97 return (m_position == x.m_position && m_orientation == x.m_orientation);
98}
99// 定义geometry_msgs::msg::Pose类的不等运算符重载函数
100// 参数x是一个const引用,表示要与之比较的另一个Pose对象
101// 函数通过对相等运算符取反来判断两个Pose对象是否不相等,返回相应的比较结果(true或false)
103 const Pose& x) const
104{
105 return !(*this == x);
106}
107// 获取Pose对象在CDR序列化时的最大可能尺寸(考虑对齐等因素),当前函数忽略传入的current_alignment参数
108// 返回geometry_msgs_msg_Pose_max_cdr_typesize这个静态定义的尺寸值(具体值应该在别处定义)
115// 获取给定Pose对象在当前对齐要求下的CDR序列化尺寸
116// 参数data是要序列化的Pose对象,current_alignment是当前的对齐要求
117// 先记录初始的对齐情况initial_alignment,然后分别计算其包含的Point类型的成员变量position和Quaternion类型的成员变量orientation的序列化尺寸,并累加到current_alignment上,最后返回尺寸差值,即该Pose对象的序列化尺寸
128// 将当前Pose对象进行CDR序列化,将成员变量m_position和m_orientation按照CDR格式依次写入到给定的Cdr对象scdr中
130 eprosima::fastcdr::Cdr& scdr) const
131{
132 scdr << m_position;
133 scdr << m_orientation;
134}
135// 从给定的Cdr对象dcdr中反序列化数据到当前Pose对象的成员变量m_position和m_orientation中,按照CDR格式进行读取赋值
137 eprosima::fastcdr::Cdr& dcdr)
138{
139 dcdr >> m_position;
140 dcdr >> m_orientation;
141}
142
143/*!
144 * @brief This function copies the value in member position
145 * @param _position New value to be copied in member position
146 */
148 const geometry_msgs::msg::Point& _position)
149{
150 m_position = _position;
151}
152
153/*!
154 * @brief This function moves the value in member position
155 * @param _position New value to be moved in member position
156 */
158 geometry_msgs::msg::Point&& _position)
159{
160 m_position = std::move(_position);
161}
162
163/*!
164 * @brief This function returns a constant reference to member position
165 * @return Constant reference to member position
166 */
168{
169 return m_position;
170}
171
172/*!
173 * @brief This function returns a reference to member position
174 * @return Reference to member position
175 */
180
181/*!
182 * @brief This function copies the value in member orientation
183 * @param _orientation New value to be copied in member orientation
184 */
186 const geometry_msgs::msg::Quaternion& _orientation)
187{
188 m_orientation = _orientation;
189}
190
191/*!
192 * @brief This function moves the value in member orientation
193 * @param _orientation New value to be moved in member orientation
194 */
196 geometry_msgs::msg::Quaternion&& _orientation)
197{
198 m_orientation = std::move(_orientation);
199}
200
201/*!
202 * @brief This function returns a constant reference to member orientation
203 * @return Constant reference to member orientation
204 */
206{
207 return m_orientation;
208}
209
210/*!
211 * @brief This function returns a reference to member orientation
212 * @return Reference to member orientation
213 */
218
219
226
228{
229 return false;
230}
231
233 eprosima::fastcdr::Cdr& scdr) const
234{
235 (void) scdr;
236}
#define geometry_msgs_msg_Pose_max_cdr_typesize
Definition Odometry.cpp:39
#define geometry_msgs_msg_Pose_max_key_cdr_typesize
Definition Odometry.cpp:49
return current_alignment initial_alignment
This class represents the structure Point defined by the user in the IDL file.
Definition Point.h:71
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Point &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition Point.cpp:116
此类表示IDL文件中定义的Pose结构。 <>
Definition Pose.h:75
eProsima_user_DllExport Pose()
默认构造函数。
Definition Pose.cpp:44
static eProsima_user_DllExport bool isKeyDefined()
告诉您是否为此类型定义了键。
Definition Pose.cpp:227
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
使用CDR序列化对对象进行反序列化。
Definition Pose.cpp:136
eProsima_user_DllExport const geometry_msgs::msg::Quaternion & orientation() const
返回成员orientation的常量引用。
Definition Pose.cpp:205
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
返回对象的最大序列化大小,取决于缓冲区对齐。
Definition Pose.cpp:109
geometry_msgs::msg::Point m_position
Definition Pose.h:237
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
使用CDR序列化序列化对象的键成员。
Definition Pose.cpp:232
eProsima_user_DllExport bool operator!=(const Pose &x) const
比较运算符。
Definition Pose.cpp:102
eProsima_user_DllExport ~Pose()
默认析构函数。
Definition Pose.cpp:48
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Pose &data, size_t current_alignment=0)
返回数据的序列化大小,取决于缓冲区对齐。
Definition Pose.cpp:118
eProsima_user_DllExport void orientation(const geometry_msgs::msg::Quaternion &_orientation)
复制成员orientation的值。
Definition Pose.cpp:185
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
返回对象键的最大序列化大小,取决于缓冲区对齐。
Definition Pose.cpp:220
geometry_msgs::msg::Quaternion m_orientation
Definition Pose.h:238
eProsima_user_DllExport bool operator==(const Pose &x) const
比较运算符。
Definition Pose.cpp:94
eProsima_user_DllExport Pose & operator=(const Pose &x)
拷贝赋值运算符。
Definition Pose.cpp:72
eProsima_user_DllExport void position(const geometry_msgs::msg::Point &_position)
复制成员position的值。
Definition Pose.cpp:147
eProsima_user_DllExport const geometry_msgs::msg::Point & position() const
返回成员position的常量引用。
Definition Pose.cpp:167
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
使用CDR序列化对对象进行序列化。
Definition Pose.cpp:129
This class represents the structure Quaternion defined by the user in the IDL file.
Definition Quaternion.h:71
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Quaternion &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.