CARLA
 
载入中...
搜索中...
未找到
PosePubSubTypes.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 PosePubSubTypes.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_POSE_PUBSUBTYPES_H_
23#define _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POSE_PUBSUBTYPES_H_
24
25#include <fastdds/dds/topic/TopicDataType.hpp>
26#include <fastrtps/utils/md5.h>
27
28#include "Pose.h"
29
30#include "PointPubSubTypes.h"
32
33#if !defined(GEN_API_VER) || (GEN_API_VER != 1)
34#error \
35 Generated Pose is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen.
36#endif // GEN_API_VER
37
38namespace geometry_msgs
39{
40 namespace msg
41 {
42 #ifndef SWIG
43 namespace detail {
44
45 template<typename Tag, typename Tag::type M>
46 struct Pose_rob
47 {
48 friend constexpr typename Tag::type get(
49 Tag)
50 {
51 return M;
52 }
53 };
54
55 struct Pose_f
56 {
58 friend constexpr type get(
59 Pose_f);
60 };
61
63
64 template <typename T, typename Tag>
65 inline size_t constexpr Pose_offset_of() {
66 return ((::size_t) &reinterpret_cast<char const volatile&>((((T*)0)->*get(Tag()))));
67 }
68 }
69 #endif
70
71 /*!
72 * @brief This class represents the TopicDataType of the type Pose defined by the user in the IDL file.
73 * @ingroup POSE
74 */
75// 定义一个名为PosePubSubType的类,它继承自eprosima::fastdds::dds::TopicDataType类
76 class PosePubSubType : public eprosima::fastdds::dds::TopicDataType
77 {
78 public:
79
80// 定义一个类型别名,将类型名Pose作为该类内部使用的类型指代,方便后续代码中使用
81 typedef Pose type;
82
83// 构造函数,使用eProsima_user_DllExport修饰,通常用于在动态链接库中导出该函数,方便外部调用
85
86 // 析构函数,使用virtual关键字表示这是一个虚析构函数,且使用eProsima_user_DllExport修饰用于在动态链接库中导出,
87 // override关键字表明它重写了基类中的虚析构函数,用于在对象销毁时进行正确的资源清理等操作
89
90// 序列化函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,它接收要序列化的数据指针和一个用于存放序列化后负载的结构体指针,
91 // override关键字表明重写了基类中的相应虚函数,用于将给定的数据按照特定规则进行序列化,以便在网络等场景中传输
92 eProsima_user_DllExport virtual bool serialize(
93 void* data,
94 eprosima::fastrtps::rtps::SerializedPayload_t* payload) override;
95
96// 反序列化函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,接收序列化后的负载结构体指针以及用于存放反序列化后数据的指针,
97 // override关键字表明重写了基类中的相应虚函数,用于将接收到的序列化数据还原成原始的数据结构
98 eProsima_user_DllExport virtual bool deserialize(
99 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
100 void* data) override;
101
102 // 获取序列化后数据大小的函数提供者函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,
103 // 接收一个数据指针,返回一个无符号32位整数的函数对象,override关键字表明重写了基类中的相应虚函数,
104 // 该函数主要用于获取给定数据序列化后的大小信息
105 eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(
106 void* data) override;
107
108// 获取键值的函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,接收数据指针、实例句柄指针以及一个布尔值(用于指定是否强制使用MD5等相关操作),
109 // override关键字表明重写了基类中的相应虚函数,用于根据数据获取对应的键值,键值在一些数据关联、查找等操作中会起到重要作用
110 eProsima_user_DllExport virtual bool getKey(
111 void* data,
112 eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
113 bool force_md5 = false) override;
114
115// 创建数据的函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,override关键字表明重写了基类中的相应虚函数,
116 // 该函数用于创建对应类型的数据对象,通常在需要初始化一个新的数据实例时调用
117 eProsima_user_DllExport virtual void* createData() override;
118
119// 删除数据的函数,使用eProsima_user_DllExport修饰用于在动态链接库中导出,接收一个数据指针,
120 // override关键字表明重写了基类中的相应虚函数,用于释放由createData等方式创建的数据所占用的内存资源等
121 eProsima_user_DllExport virtual void deleteData(
122 void* data) override;
123
124 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
125 eProsima_user_DllExport inline bool is_bounded() const override
126 {
127 return true;
128 }
129
130 #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
131
132 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
133 eProsima_user_DllExport inline bool is_plain() const override
134 {
135 return is_plain_impl();
136 }
137
138 #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
139
140 #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
141 eProsima_user_DllExport inline bool construct_sample(
142 void* memory) const override
143 {
144 new (memory) Pose();
145 return true;
146 }
147
148 #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
149 MD5 m_md5;
150 unsigned char* m_keyBuffer;
151 private:
152 static constexpr bool is_plain_impl()
153 {
154 return 56ULL == (detail::Pose_offset_of<Pose, detail::Pose_f>() + sizeof(geometry_msgs::msg::Quaternion));
155
156 }};
157 }
158}
159
160#endif // _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_POSE_PUBSUBTYPES_H_
#define eProsima_user_DllExport
Definition CameraInfo.h:44
Traits::size_t size_t
This class represents the TopicDataType of the type Pose defined by the user in the IDL file.
static constexpr bool is_plain_impl()
此类表示IDL文件中定义的Pose结构。 <>
Definition Pose.h:75
This class represents the structure Quaternion defined by the user in the IDL file.
Definition Quaternion.h:71
size_t constexpr Pose_offset_of()
friend constexpr type get(Pose_f)
geometry_msgs::msg::Quaternion Pose::* type
friend constexpr Tag::type get(Tag)