CARLA
 
载入中...
搜索中...
未找到
Vector3PubSubTypes.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 Vector3PubSubTypes.h
17 * This header file contains the declaration of the serialization functions.
18 *
19 * This file was generated by the tool fastcdrgen.
20 */
21
22#ifndef _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_VECTOR3_PUBSUBTYPES_H_
23#define _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_VECTOR3_PUBSUBTYPES_H_
24
25#include <fastdds/dds/topic/TopicDataType.hpp>// 包含 Fast DDS 主题数据类型定义
26#include <fastrtps/utils/md5.h>// 包含 MD5 工具以进行数据完整性检查
27
28#include "Vector3.h"// 包含 Vector3 结构的定义
29
30#if !defined(GEN_API_VER) || (GEN_API_VER != 1)// 检查生成的 API 版本是否与预期版本匹配
31#error \
32 生成的 Vector3 与当前安装的 Fast DDS 不兼容。请使用 fastddsgen 重新生成。
33#endif // GEN_API_VER
34
35namespace geometry_msgs
36{
37 namespace msg
38 {
39
40 #ifndef SWIG
41 namespace detail {
42// 模板结构用于辅助成员变量访问
43 template<typename Tag, typename Tag::type M>
45 {
46 friend constexpr typename Tag::type get(
47 Tag)
48 {
49 return M;// 返回成员变量
50 }
51 };
52// 用于访问 Vector3 的 z 组件的标签结构
53 struct Vector3_f
54 {
55 typedef double Vector3::* type;// 定义类型为指向 Vector3 中 double 成员的指针
56 friend constexpr type get(
57 Vector3_f);// 友元函数以访问该类型
58 };
59// Vector3 的 z 组件的特化
61// 获取 Vector3 结构中成员变量的偏移量
62 template <typename T, typename Tag>
63 inline size_t constexpr Vector3_offset_of() {
64 return ((::size_t) &reinterpret_cast<char const volatile&>((((T*)0)->*get(Tag()))));
65 }
66 }
67 #endif
68
69 /*!
70 * @brief 此类表示用户在 IDL 文件中定义的 Vector3 类型的 TopicDataType。
71 * @ingroup VECTOR3
72 */
73 class Vector3PubSubType : public eprosima::fastdds::dds::TopicDataType
74 {
75 public:
76
77 typedef Vector3 type;// 定义类型为 Vector3
78
80
81 eProsima_user_DllExport virtual ~Vector3PubSubType() override;// 析构函数
82// 将 Vector3 数据序列化为有效负载
83 eProsima_user_DllExport virtual bool serialize(
84 void* data,
85 eprosima::fastrtps::rtps::SerializedPayload_t* payload) override;
86// 将有效负载反序列化为 Vector3 数据
87 eProsima_user_DllExport virtual bool deserialize(
88 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
89 void* data) override;
90// 提供序列化数据的大小
91 eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(
92 void* data) override;
93// 获取 Vector3 实例的键
94 eProsima_user_DllExport virtual bool getKey(
95 void* data,
96 eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
97 bool force_md5 = false) override;
98// 创建一个新的 Vector3 实例
99 eProsima_user_DllExport virtual void* createData() override;
100// 删除一个 Vector3 实例
101 eProsima_user_DllExport virtual void deleteData(
102 void* data) override;
103
104 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED// 检查数据类型是否是有界的
105 eProsima_user_DllExport inline bool is_bounded() const override
106 {
107 return true;// Vector3 是一个有界类型
108 }
109
110 #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
111
112 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN// 检查数据类型是否是简单的
113 eProsima_user_DllExport inline bool is_plain() const override
114 {
115 return is_plain_impl();// 调用实现检查是否简单
116 }
117
118 #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
119
120 #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE// 在提供的内存中构造 Vector3 的样本
121 eProsima_user_DllExport inline bool construct_sample(
122 void* memory) const override
123 {
124 new (memory) Vector3();// 使用定位 new 构造 Vector3
125 return true;
126 }
127
128 #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
129 MD5 m_md5;// 用于数据完整性的 MD5 哈希
130 unsigned char* m_keyBuffer;// 键的缓冲区
131 private:// 根据大小和布局检查 Vector3 类型是否简单
132 static constexpr bool is_plain_impl()
133 {
134 return 24ULL == (detail::Vector3_offset_of<Vector3, detail::Vector3_f>() + sizeof(double));
135
136 }};
137 }
138}
139
140#endif // _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_VECTOR3_PUBSUBTYPES_H_
#define eProsima_user_DllExport
Definition CameraInfo.h:44
Traits::size_t size_t
此类表示用户在 IDL 文件中定义的 Vector3 类型的 TopicDataType。 <>
此类表示用户在 IDL 文件中定义的 Vector3 结构。 <>
Definition Vector3.h:72
size_t constexpr Vector3_offset_of()
friend constexpr type get(Vector3_f)
friend constexpr Tag::type get(Tag)