CARLA
 
载入中...
搜索中...
未找到
PointField.cpp
浏览该文件的文档.
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 PointField.cpp
17 * This source file contains the definition of the described types in the IDL file.
18 *
19 * This file was generated by the tool gen.
20 */
21
22#ifdef _WIN32
23// Remove linker warning LNK4221 on Visual Studio
24namespace {
25char dummy;
26} // namespace
27#endif // _WIN32
28
29#include "PointField.h"
30#include <fastcdr/Cdr.h>
31
32#include <fastcdr/exceptions/BadParamException.h>
33using namespace eprosima::fastcdr::exception;
34
35#include <utility>
36
37#define sensor_msgs_msg_PointField_max_cdr_typesize 272ULL;
38#define sensor_msgs_msg_PointField_max_key_cdr_typesize 0ULL;
39
41{
42 // string m_name
43 m_name ="";
44 // unsigned long m_offset
45 m_offset = 0;
46 // octet m_datatype
47 m_datatype = 0;
48 // unsigned long m_count
49 m_count = 0;
50}
51
55
57 const PointField& x)
58{
59 m_name = x.m_name;
60 m_offset = x.m_offset;
61 m_datatype = x.m_datatype;
62 m_count = x.m_count;
63}
64
66 PointField&& x) noexcept
67{
68 m_name = std::move(x.m_name);
69 m_offset = x.m_offset;
70 m_datatype = x.m_datatype;
71 m_count = x.m_count;
72}
73
75 const PointField& x)
76{
77 m_name = x.m_name;
78 m_offset = x.m_offset;
79 m_datatype = x.m_datatype;
80 m_count = x.m_count;
81
82 return *this;
83}
84
86 PointField&& x) noexcept
87{
88 m_name = std::move(x.m_name);
89 m_offset = x.m_offset;
90 m_datatype = x.m_datatype;
91 m_count = x.m_count;
92
93 return *this;
94}
95
97 const PointField& x) const
98{
99 return (m_name == x.m_name && m_offset == x.m_offset && m_datatype == x.m_datatype && m_count == x.m_count);
100}
101
103 const PointField& x) const
104{
105 return !(*this == x);
106}
107
114
117 size_t current_alignment)
118{
119 // 保存当前对齐位置
121
122 // 计算 `name` 字符串的序列化大小
123 // `name` 是一个字符串,先加上其大小(4字节),然后考虑到4字节对齐,
124 // 加上字符串的长度,最后再加上1字节用于字符串结束符('\0')
125 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.name().size() + 1;
126
127 // 计算 `offset` 的序列化大小(4字节)
128 // 加上4字节并考虑到4字节对齐
129 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
130
131 // 计算 `datatype` 的序列化大小(1字节)
132 // 加上1字节并考虑到1字节对齐
133 current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
134
135 // 计算 `count` 的序列化大小(4字节)
136 // 加上4字节并考虑到4字节对齐
137 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
138
139 // 返回序列化后的数据总大小(当前对齐位置与初始对齐位置之差)
141}
142
143
145 eprosima::fastcdr::Cdr& scdr) const
146{
147 scdr << m_name.c_str();
148 scdr << m_offset;
149 scdr << m_datatype;
150 scdr << m_count;
151}
152
154 eprosima::fastcdr::Cdr& dcdr)
155{
156 dcdr >> m_name;
157 dcdr >> m_offset;
158 dcdr >> m_datatype;
159 dcdr >> m_count;
160}
161
162/*!
163 * @brief This function copies the value in member name
164 * @param _name New value to be copied in member name
165 */
167 const std::string& _name)
168{
169 m_name = _name;
170}
171
172/*!
173 * @brief This function moves the value in member name
174 * @param _name New value to be moved in member name
175 */
177 std::string&& _name)
178{
179 m_name = std::move(_name);
180}
181
182/*!
183 * @brief This function returns a constant reference to member name
184 * @return Constant reference to member name
185 */
186const std::string& sensor_msgs::msg::PointField::name() const
187{
188 return m_name;
189}
190
191/*!
192 * @brief This function returns a reference to member name
193 * @return Reference to member name
194 */
196{
197 return m_name;
198}
199
200/*!
201 * @brief This function sets a value in member offset
202 * @param _offset New value for member offset
203 */
205 uint32_t _offset)
206{
207 m_offset = _offset;
208}
209
210/*!
211 * @brief This function returns the value of member offset
212 * @return Value of member offset
213 */
215{
216 return m_offset;
217}
218
219/*!
220 * @brief This function returns a reference to member offset
221 * @return Reference to member offset
222 */
224{
225 return m_offset;
226}
227
228/*!
229 * @brief This function sets a value in member datatype
230 * @param _datatype New value for member datatype
231 */
233 uint8_t _datatype)
234{
235 m_datatype = _datatype;
236}
237
238/*!
239 * @brief This function returns the value of member datatype
240 * @return Value of member datatype
241 */
243{
244 return m_datatype;
245}
246
247/*!
248 * @brief This function returns a reference to member datatype
249 * @return Reference to member datatype
250 */
252{
253 return m_datatype;
254}
255
256/*!
257 * @brief This function sets a value in member count
258 * @param _count New value for member count
259 */
261 uint32_t _count)
262{
263 m_count = _count;
264}
265
266/*!
267 * @brief This function returns the value of member count
268 * @return Value of member count
269 */
271{
272 return m_count;
273}
274
275/*!
276 * @brief This function returns a reference to member count
277 * @return Reference to member count
278 */
280{
281 return m_count;
282}
283
290
292{
293 return false;
294}
295
297 eprosima::fastcdr::Cdr& scdr) const
298{
299 (void) scdr;
300}
#define sensor_msgs_msg_PointField_max_cdr_typesize
#define sensor_msgs_msg_PointField_max_key_cdr_typesize
return current_alignment initial_alignment
此类表示用户在 IDL 文件中定义的结构 PointField。 <>
Definition PointField.h:79
eProsima_user_DllExport uint32_t offset() const
此函数返回成员 offset 的值
static eProsima_user_DllExport bool isKeyDefined()
此函数告诉您此类型的键是否已定义
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
此函数使用 CDR 序列化反序列化对象。
eProsima_user_DllExport PointField & operator=(const PointField &x)
复制赋值运算符。
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
此函数返回对象键的最大序列化大小 取决于缓冲区对齐。
eProsima_user_DllExport bool operator!=(const PointField &x) const
比较运算符。
eProsima_user_DllExport uint32_t count() const
此函数返回成员 count 的值
eProsima_user_DllExport PointField()
默认构造函数。
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
此函数返回对象的最大序列化大小 取决于缓冲区对齐。
static eProsima_user_DllExport size_t getCdrSerializedSize(const sensor_msgs::msg::PointField &data, size_t current_alignment=0)
此函数返回数据的序列化大小 取决于缓冲区对齐。
eProsima_user_DllExport bool operator==(const PointField &x) const
比较运算符。
eProsima_user_DllExport void name(const std::string &_name)
此函数复制成员 name 的值
eProsima_user_DllExport const std::string & name() const
此函数返回成员 name 的常量引用
eProsima_user_DllExport uint8_t datatype() const
此函数返回成员 datatype 的值
eProsima_user_DllExport ~PointField()
默认析构函数。
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
此函数使用 CDR 序列化序列化对象。
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
此函数使用 CDR 序列化序列化对象的键成员。