CARLA
 
载入中...
搜索中...
未找到
TimePubSubTypes.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 TimePubSubTypes.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_BUILTIN_INTERFACES_MSG_TIME_PUBSUBTYPES_H_
23#define _FAST_DDS_GENERATED_BUILTIN_INTERFACES_MSG_TIME_PUBSUBTYPES_H_
24// 这是预处理指令中的条件编译指令,用于防止头文件被重复包含。
25
26#include <fastdds/dds/topic/TopicDataType.hpp>
27// 引入Fast DDS库中与主题数据类型(TopicDataType)相关的头文件
28
29#include <fastrtps/utils/md5.h>
30// 引入Fast RTPS(Fast DDS的一部分)中与MD5相关的工具头文件
31
32#include "Time.h"
33// 引入名为“Time.h”的头文件
34
35#if !defined(GEN_API_VER) || (GEN_API_VER != 1)
36#error \
37 Generated Time is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen.
38#endif // GEN_API_VER
39
40namespace builtin_interfaces
41{
42 namespace msg
43 {
44 /*!
45 * @brief This class represents the TopicDataType of the type Time defined by the user in the IDL file.
46 * @ingroup TIME
47 */
48 class TimePubSubType : public eprosima::fastdds::dds::TopicDataType
49 {
50// 上述是一段Doxygen风格的注释,用于说明这个类(TimePubSubType)的作用,
51// 即它代表了用户在IDL文件中定义的“Time”类型的主题数据类型
52 public:
53
54 typedef Time type;
55 // 使用typedef为“Time”类型定义一个别名“type”,在类内部可以更方便地引用“Time”这个数据类型
56
58 // 声明类的构造函数
59// 使得该函数可以在库外被调用,构造函数用于创建TimePubSubType类的对象实例。
60
62// 声明类的析构函数,同样使用“eProsima_user_DllExport”修饰,并且使用“override”关键字表示重写了基类的析构函数,
63// 用于在对象销毁时释放相关资源。
64
66 void* data,
67 eprosima::fastrtps::rtps::SerializedPayload_t* payload) override;
68 // 声明一个虚函数“serialize”,用于将给定的数据进行序列化,
69 // 并将序列化后的结果存储到“eprosima::fastrtps::rtps::SerializedPayload_t”类型的对象中
70
72 eprosima::fastrtps::rtps::SerializedPayload_t* payload,
73 void* data) override;
74 // 声明一个虚函数“deserialize”,用于将给定的序列化后的数据(参数“payload”指向的对象)进行反序列化,
75// 并将结果存储到“data”指向的内存空间中
76
77 eProsima_user_DllExport virtual std::function<uint32_t()> getSerializedSizeProvider(
78 void* data) override;
79// 声明一个虚函数“getSerializedSizeProvider”,它返回一个可调用对象
80
82 void* data,
83 eprosima::fastrtps::rtps::InstanceHandle_t* ihandle,
84 bool force_md5 = false) override;
85// 声明一个虚函数“getKey”,用于获取给定数据的关键信息
86 // 将关键信息存储到“eprosima::fastrtps::rtps::InstanceHandle_t”类型的对象中
87 // “force_md5”参数默认值为“false”
88
89 eProsima_user_DllExport virtual void* createData() override;
90// 声明一个虚函数“createData”,用于创建与该主题数据类型相关的数据对象
91
93 void* data) override;
94// 声明一个虚函数“deleteData”,用于删除给定的数据对象
95
96 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
97 eProsima_user_DllExport inline bool is_bounded() const override
98 {
99 return true;
100 }
101 // 条件编译部分,如果定义了“TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED”宏,
102 // 则定义一个内联函数“is_bounded”,它重写了基类的相应函数(通过“override”标识),
103
104 #endif // TOPIC_DATA_TYPE_API_HAS_IS_BOUNDED
105
106 #ifdef TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
107 eProsima_user_DllExport inline bool is_plain() const override
108 {
109 return true;
110 }
111
112 #endif // TOPIC_DATA_TYPE_API_HAS_IS_PLAIN
113
114 #ifdef TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
115 eProsima_user_DllExport inline bool construct_sample(
116 void* memory) const override
117 {
118 new (memory) Time();
119 return true;
120 }
121// 在给定的内存空间(“memory”指向的内存)中使用定位new操作符创建一个“Time”类型的数据对象
122
123 #endif // TOPIC_DATA_TYPE_API_HAS_CONSTRUCT_SAMPLE
124 MD5 m_md5;
125// 定义一个成员变量“m_md5”,类型为“MD5”
126
127 unsigned char* m_keyBuffer;
128 // 定义一个成员变量“m_keyBuffer”,类型为指向无符号字符
129 };
130 }
131}
132
133#endif // _FAST_DDS_GENERATED_BUILTIN_INTERFACES_MSG_TIME_PUBSUBTYPES_H_
#define eProsima_user_DllExport
Definition CameraInfo.h:44
This class represents the TopicDataType of the type Time defined by the user in the IDL file.
virtual eProsima_user_DllExport bool getKey(void *data, eprosima::fastrtps::rtps::InstanceHandle_t *ihandle, bool force_md5=false) override
virtual eProsima_user_DllExport std::function< uint32_t()> getSerializedSizeProvider(void *data) override
virtual eProsima_user_DllExport ~TimePubSubType() override
virtual eProsima_user_DllExport void deleteData(void *data) override
virtual eProsima_user_DllExport bool deserialize(eprosima::fastrtps::rtps::SerializedPayload_t *payload, void *data) override
virtual eProsima_user_DllExport void * createData() override
virtual eProsima_user_DllExport bool serialize(void *data, eprosima::fastrtps::rtps::SerializedPayload_t *payload) override
此类表示用户在IDL文件中定义的Time结构。