CARLA
 
载入中...
搜索中...
未找到
TransformPubSubTypes.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 TransformPubSubTypes.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_TRANSFORM_PUBSUBTYPES_H_
23#define _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_TRANSFORM_PUBSUBTYPES_H_
24
25#include <fastdds/dds/topic/TopicDataType.hpp>
26#include <fastrtps/utils/md5.h>
27
28#include "Transform.h"
29
30#include "Vector3PubSubTypes.h"
32
33#if !defined(GEN_API_VER) || (GEN_API_VER != 1)
34#error \
35 Generated Transform 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
43 #ifndef SWIG
44 namespace detail {
45
46 template<typename Tag, typename Tag::type M>
48 {
49 friend constexpr typename Tag::type get(
50 Tag)
51 {
52 return M;
53 }
54 };
55
57 {
59 friend constexpr type get(
61 };
62
64
65 template <typename T, typename Tag>
66 inline size_t constexpr Transform_offset_of() {
67 return ((::size_t) &reinterpret_cast<char const volatile&>((((T*)0)->*get(Tag()))));
68 }
69 }
70 #endif
71
72 /*!
73 * @brief This class represents the TopicDataType of the type Transform defined by the user in the IDL file.
74 * @ingroup TRANSFORM
75 */
76 class TransformPubSubType : public eprosima::fastdds::dds::TopicDataType
77 {
78 public:
79// 定义一个类型别名,将 `Transform` 类型重命名为 `type`,方便后续在代码中使用该类型时书写更简洁,通常用于表示一种特定的数据类型(这里 `Transform` 具体是什么类型需看前置定义)
80 typedef Transform type;
81 // 导出函数(可能用于动态链接库相关场景,具体取决于 `eProsima_user_DllExport` 的定义),该函数返回 `Transform` 类型对应的发布/订阅类型相关信息,函数名以大写字母开头符合某种命名规范(可能是类相关接口函数的命名风格)
83// 导出函数(用于动态链接库相关场景),定义虚析构函数,使用 `override` 关键字表示重写了基类中的虚析构函数,用于在对象销毁时进行正确的资源清理等操作,具体清理逻辑取决于该类及其派生类的具体实现
85 // 导出函数(用于动态链接库相关场景),定义一个虚函数用于序列化操作。参数 `data` 表示要被序列化的数据(具体类型可能是 `Transform` 或者与之相关,取决于上下文),`payload` 是用于存储序列化后的数据负载的结构体(`SerializedPayload_t` 类型,其定义应该来自 `eprosima::fastrtps::rtps` 命名空间),函数返回值为布尔类型,用于表示序列化操作是否成功
86 eProsima_user_DllExport virtual bool serialize(
87 void* data,
88 eprosima::fastrtps::rtps::SerializedPayload_t* payload) override;
89 // 导出函数(用于动态链接库相关场景),定义一个虚函数用于反序列化操作。参数 `payload` 是包含序列化后数据负载的结构体(从中获取数据进行反序列化),`data` 是用于存储反序列化后得到的数据的内存地址(指针),函数返回值为布尔类型,用于表示反序列化操作是否成功
90 eProsima_user_DllExport virtual bool deserialize(
91 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
92 void* data) override;
93// 导出函数(用于动态链接库相关场景),定义一个虚函数,用于获取序列化后数据大小的提供函数(以 `std::function` 形式返回一个无符号32位整数的函数对象),参数 `data` 是要获取序列化大小所对应的原始数据,通过该函数可以动态地根据具体数据内容确定其序列化后的大小,方便在一些场景下进行内存分配等操作
94 eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(
95 void* data) override;
96 // 导出函数(用于动态链接库相关场景),定义一个虚函数用于获取数据的键值(可能用于在发布/订阅系统中标识、查找等用途)。参数 `data` 是原始数据,`ihandle` 是用于存储实例句柄的结构体(`InstanceHandle_t` 类型,来自 `eprosima::fastrtps::rtps` 命名空间),`force_md5` 是一个布尔类型的可选参数,用于指定是否强制使用MD5相关的方式获取键值(具体含义取决于具体实现逻辑),函数返回值为布尔类型,表示获取键值操作是否成功
97 eProsima_user_DllExport virtual bool getKey(
98 void* data,
99 eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
100 bool force_md5 = false) override;
101 // 导出函数(用于动态链接库相关场景),定义一个虚函数用于创建数据,返回一个指向新创建的数据的指针(`void*` 类型,具体指向的数据类型应该与该类所处理的数据类型相关,比如 `Transform` 相关),该函数可能用于在发布/订阅等操作中初始化要处理的数据对象
102 eProsima_user_DllExport virtual void* createData() override;
103// 导出函数(用于动态链接库相关场景),定义一个虚函数用于删除数据,参数 `data` 是要删除的指向数据的指针(指向之前创建的数据对象),该函数负责释放对应的数据所占用的内存资源等操作,确保数据被正确清理
104 eProsima_user_DllExport virtual void deleteData(
105 void* data) override;
106
107 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
108 eProsima_user_DllExport inline bool is_bounded() const override
109 {
110 return true;
111 }
112
113 #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
114
115 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
116 eProsima_user_DllExport inline bool is_plain() const override
117 {
118 return is_plain_impl();
119 }
120
121 #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
122
123 #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
124 eProsima_user_DllExport inline bool construct_sample(
125 void* memory) const override
126 {
127 new (memory) Transform();
128 return true;
129 }
130
131 #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
132 MD5 m_md5;
133 unsigned char* m_keyBuffer;
134 private:
135 static constexpr bool is_plain_impl()
136 {
137 return 56ULL == (detail::Transform_offset_of<Transform, detail::Transform_f>() + sizeof(geometry_msgs::msg::Quaternion));
138
139 }};
140 }
141}
142
143#endif // _FAST_DDS_GENERATED_GEOMETRY_MSGS_MSG_TRANSFORM_PUBSUBTYPES_H_
#define eProsima_user_DllExport
Definition CameraInfo.h:44
Traits::size_t size_t
This class represents the structure Quaternion defined by the user in the IDL file.
Definition Quaternion.h:71
This class represents the TopicDataType of the type Transform defined by the user in the IDL file.
此类表示用户在IDL文件中定义的Transform结构。
size_t constexpr Transform_offset_of()
friend constexpr type get(Transform_f)
geometry_msgs::msg::Quaternion Transform::* type