CARLA
 
载入中...
搜索中...
未找到
Point32.h
浏览该文件的文档.
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 Point32.h
17 * This header file contains the declaration of the described types in the IDL file.
18 *
19 * This file was generated by the tool gen.
20 */
21// 防止头文件被重复包含,如果 _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POINT32_H_ 这个宏已经被定义过了,
22// 则下面的代码不会再被编译,避免重复定义等问题
23#ifndef _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POINT32_H_
24#define _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POINT32_H_
25// 包含 fastrtps 库中用于固定大小字符串的头文件,可能在后续处理字符串相关操作时会用到
26#include <fastrtps/utils/fixed_size_string.hpp>
27// 包含标准C/C++中用于基本整数类型定义的头文件
28#include <stdint.h>
29// 包含标准C++中数组相关的头文件,用于操作数组类型的数据结构
30#include <array>
31// 包含标准C++中字符串相关的头文件,用于操作字符串对象
32#include <string>
33// 包含标准C++中向量(动态数组)相关的头文件,方便处理可变长度的数据集合
34#include <vector>
35// 包含标准C++中映射(关联容器,类似字典)相关的头文件,用于键值对形式的数据存储和查找
36#include <map>
37// 包含标准C++中 bitset(位集合)相关的头文件,可用于按位操作和存储位相关的数据
38#include <bitset>
39// 以下是针对Windows平台的条件编译代码块
40#if defined(_WIN32)
41// 如果定义了 EPROSIMA_USER_DLL_EXPORT 这个宏,将 eProsima_user_DllExport 定义为 __declspec( dllexport ),
42// 这通常用于在Windows下导出动态链接库中的符号(函数、类等),以便外部程序可以使用
43#if defined(EPROSIMA_USER_DLL_EXPORT)
44#define eProsima_user_DllExport __declspec( dllexport )
45 // 如果没有定义 EPROSIMA_USER_DLL_EXPORT 宏,则简单地定义 eProsima_user_DllExport 为空,
46 // 具体含义可能在后续代码根据是否为空进行不同处理
47#else
48#define eProsima_user_DllExport
49#endif // EPROSIMA_USER_DLL_EXPORT
50// 如果不是Windows平台,也简单地定义 eProsima_user_DllExport 为空
51#else
52#define eProsima_user_DllExport
53#endif // _WIN32
54// 又是针对Windows平台的条件编译代码块,主要用于处理 Point32 相关的动态链接库导入导出相关的定义
55#if defined(_WIN32)
56#if defined(EPROSIMA_USER_DLL_EXPORT)
57// 如果同时定义了 Point32_SOURCE 和 EPROSIMA_USER_DLL_EXPORT,将 Point32_DllAPI 定义为 __declspec( dllexport ),
58// 表示导出 Point32 相关的符号(比如类等)
59#if defined(Point32_SOURCE)
60#define Point32_DllAPI __declspec( dllexport )
61// 如果只定义了 EPROSIMA_USER_DLL_EXPORT 但没定义 Point32_SOURCE,将 Point32_DllAPI 定义为 __declspec( dllimport ),
62// 表示从外部动态链接库中导入 Point32 相关符号,也就是使用其他地方已经编译好的相关代码
63#else
64#define Point32_DllAPI __declspec( dllimport )
65#endif // Point32_SOURCE
66 // 如果没有定义 EPROSIMA_USER_DLL_EXPORT,将 Point32_DllAPI 定义为空
67#else
68#define Point32_DllAPI
69#endif // EPROSIMA_USER_DLL_EXPORT
70// 非Windows平台下,同样将 Point32_DllAPI 定义为空
71#else
72#define Point32_DllAPI
73#endif // _WIN32
74// 定义 eprosima 命名空间,在其中可能包含与该项目相关的多个子命名空间和类型等
75namespace eprosima {
76// 定义 fastcdr 子命名空间,里面应该是和CDR(Common Data Representation,一种数据序列化格式相关的内容)
77// 此处只是前置声明了 Cdr 类,具体定义应该在其他地方,这种前置声明可以解决循环包含等问题,让代码编译能通过
78namespace fastcdr {
79class Cdr;
80} // namespace fastcdr
81} // namespace eprosima
82// 定义 geometry_msgs 命名空间,通常用于存放和机器人相关的消息类型等定义
83namespace geometry_msgs {
84// 定义 msg 子命名空间,一般用来细分不同的消息类别等
85 namespace msg {
86 /*!
87 * @brief This class represents the structure Point32 defined by the user in the IDL file.
88 * @ingroup POINT32
89 * 这个类表示用户在IDL(接口定义语言)文件中定义的 Point32 结构体,
90 * @ingroup 相关的注释可能用于文档生成工具来对代码结构进行分组展示等,此处表示属于 POINT32 这个组
91 */
92 class Point32
93 {
94 public:
95
96 /*!
97 * 默认构造函数,用于创建一个 Point32 类的默认初始化对象
98 */
100 /*!
101 * 默认析构函数,用于在对象生命周期结束时进行资源清理等操作
102 */
104 /*!
105 * 拷贝构造函数,用于从另一个已存在的 Point32 对象创建一个新的相同副本,参数 x 是要拷贝的那个 Point32 对象的引用
106 */
108 const Point32& x);
109 /*!
110 * 移动构造函数,用于高效地“窃取”另一个 Point32 对象的资源来初始化新对象,参数 x 是要移动资源的那个 Point32 对象的引用,
111 * 它通常比拷贝构造函数更高效,适用于临时对象等情况
112 */
114 Point32&& x) noexcept;
115 /*!
116 * 拷贝赋值运算符重载,用于将一个 Point32 对象的值复制到另一个已存在的 Point32 对象中,参数 x 是提供值的那个 Point32 对象的引用
117 */
119 const Point32& x);
120 /*!
121 * 移动赋值运算符重载,用于将一个 Point32 对象的资源移动(转移)到另一个已存在的 Point32 对象中,参数 x 是提供资源的那个 Point32 对象的引用
122 */
124 Point32&& x) noexcept;
125 /*!
126 * 相等比较运算符重载,用于比较当前 Point32 对象和另一个 Point32 对象是否相等,参数 x 是要与之比较的那个 Point32 对象
127 */
129 const Point32& x) const;
130 /*!
131 * 不等比较运算符重载,用于比较当前 Point32 对象和另一个 Point32 对象是否不相等,参数 x 是要与之比较的那个 Point32 对象
132 */
134 const Point32& x) const;
135 /*!
136 * 设置成员变量 x 的值的函数,参数 _x 是要设置给成员 x 的新值
137 */
139 float _x);
140 /*!
141 * 获取成员变量 x 的值的函数,返回成员 x 当前存储的值
142 */
143 eProsima_user_DllExport float x() const;
144 /*!
145 * 返回成员变量 x 的引用的函数,通过返回引用可以直接对成员 x 进行修改等操作
146 */
147 eProsima_user_DllExport float& x();
148 /*!
149 * 设置成员变量 y 的值的函数,参数 _y 是要设置给成员 y 的新值
150 */
152 float _y);
153 /*!
154 * 获取成员变量 y 的值的函数,返回成员 y 当前存储的值
155 */
156 eProsima_user_DllExport float y() const;
157 /*!
158 * 返回成员变量 y 的引用的函数,通过返回引用可以直接对成员 y 进行修改等操作
159 */
160 eProsima_user_DllExport float& y();
161 /*!
162 * 设置成员变量 z 的值的函数,参数 _z 是要设置给成员 z 的新值
163 */
165 float _z);
166 /*!
167 * 获取成员变量 z 的值的函数,返回成员 z 当前存储的值
168 */
170 /*!
171 * 返回成员变量 z 的引用的函数,通过返回引用可以直接对成员 z 进行修改等操作
172 */
173 eProsima_user_DllExport float& z();
174 /*!
175 * 根据缓冲区对齐情况,返回一个对象最大序列化大小的函数,参数 current_alignment 是当前缓冲区的对齐方式,
176 * 返回值就是对应的最大序列化大小,用于确定存储或传输该对象时所需的最大空间等情况
177 */
179 size_t current_alignment = 0);
180 /*!
181 * 根据缓冲区对齐情况,返回给定数据的序列化大小的函数,参数 data 是要计算序列化大小的数据(这里是 Point32 类型的对象),
182 * current_alignment 是当前缓冲区的对齐方式,返回值就是对应的数据序列化后的大小,用于准确知道存储或传输该数据实际需要的空间
183 */
185 const geometry_msgs::msg::Point32& data,
186 size_t current_alignment = 0);
187 /*!
188 * 使用CDR序列化方式对对象进行序列化的函数,参数 cdr 是用于执行CDR序列化操作的对象,将当前 Point32 对象按照CDR格式进行序列化,
189 * 以便进行数据传输、存储等后续操作
190 */
192 eprosima::fastcdr::Cdr& cdr) const;
193 /*!
194 * 使用CDR序列化方式对对象进行反序列化的函数,参数 cdr 是用于执行CDR反序列化操作的对象,从给定的CDR格式数据中还原出 Point32 对象,
195 * 比如从接收到的网络数据或者存储的数据中恢复出对应的对象实例
196 */
198 eprosima::fastcdr::Cdr& cdr);
199 /*!
200 * 根据缓冲区对齐情况,返回对象的键(Key)的最大序列化大小的函数,参数 current_alignment 是当前缓冲区的对齐方式,
201 * 返回值就是对应的键的最大序列化大小,在涉及到以键值对形式处理对象等场景中会用到,比如在某些存储或查找操作中确定键的空间需求
202 */
204 size_t current_alignment = 0);
205 /*!
206 * 判断该类型是否已经定义了键(Key)的函数,如果已经定义则返回 true,否则返回 false,用于在相关操作前检查键是否存在
207 */
209 /*!
210 * 使用CDR序列化方式对对象的键成员进行序列化的函数,参数 cdr 是用于执行CDR序列化操作的对象,将当前 Point32 对象中与键相关的成员按照CDR格式进行序列化,
211 * 比如在一些需要单独处理键的场景中使用
212 */
214 eprosima::fastcdr::Cdr& cdr) const;
215 private:
216// 定义成员变量 m_x,用于存储 Point32 结构体中的 x 坐标值,类型为 float(单精度浮点数)
217 float m_x;
218// 定义成员变量 m_y,用于存储 Point32 结构体中的 y 坐标值,类型为 float(单精度浮点数)
219 float m_y;
220// 定义成员变量 m_z,用于存储 Point32 结构体中的 z 坐标值,类型为 float(单精度浮点数)
221 float m_z;
222 };
223 } // namespace msg
224} // namespace geometry_msgs
225
226#endif // _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POINT32_H_
#define eProsima_user_DllExport
Definition CameraInfo.h:44
This class represents the structure Point32 defined by the user in the IDL file.这个类表示用户在IDL(接口定义语言)文件...
Definition Point32.h:93
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
Definition Point32.cpp:151
eProsima_user_DllExport float z() const
eProsima_user_DllExport float x() const
此函数返回成员变量 x(即 m_x)的值,提供了一种只读的方式来获取 x 坐标的值,保障了数据的安全性,避免外部误修改
Definition Point32.cpp:173
eProsima_user_DllExport bool operator==(const Point32 &x) const
Definition Point32.cpp:103
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Point32 &data, size_t current_alignment=0)
Definition Point32.cpp:125
eProsima_user_DllExport Point32 & operator=(const Point32 &x)
Definition Point32.cpp:81
static eProsima_user_DllExport bool isKeyDefined()
Definition Point32.cpp:252
eProsima_user_DllExport ~Point32()
Definition Point32.cpp:58
eProsima_user_DllExport bool operator!=(const Point32 &x) const
Definition Point32.cpp:110
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
Definition Point32.cpp:258
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
Definition Point32.cpp:117
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
Definition Point32.cpp:244
eProsima_user_DllExport Point32()
Definition Point32.cpp:47
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
Definition Point32.cpp:142
eProsima_user_DllExport float y() const
此函数返回成员变量 y(即 m_y)的值,提供了一种只读的方式来获取 y 坐标的值,用于外部获取该坐标信息但不修改
Definition Point32.cpp:201