CARLA
 
载入中...
搜索中...
未找到
Quaternion.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 Quaternion.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 "Quaternion.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 geometry_msgs_msg_Quaternion_max_cdr_typesize 32ULL;
38#define geometry_msgs_msg_Quaternion_max_key_cdr_typesize 0ULL;
39
41{
42 // double m_x
43 m_x = 0.0;
44 // double m_y
45 m_y = 0.0;
46 // double m_z
47 m_z = 0.0;
48 // double m_w
49 m_w = 1.0;
50}
51
55
57 const Quaternion& x)
58{
59 m_x = x.m_x;
60 m_y = x.m_y;
61 m_z = x.m_z;
62 m_w = x.m_w;
63}
64
66 Quaternion&& x) noexcept
67{
68 m_x = x.m_x;
69 m_y = x.m_y;
70 m_z = x.m_z;
71 m_w = x.m_w;
72}
73
75 const Quaternion& x)
76{
77 m_x = x.m_x;
78 m_y = x.m_y;
79 m_z = x.m_z;
80 m_w = x.m_w;
81
82 return *this;
83}
84
86 Quaternion&& x) noexcept
87{
88 m_x = x.m_x;
89 m_y = x.m_y;
90 m_z = x.m_z;
91 m_w = x.m_w;
92
93 return *this;
94}
95
97 const Quaternion& x) const
98{
99 return (m_x == x.m_x && m_y == x.m_y && m_z == x.m_z && m_w == x.m_w);
100}
101
103 const Quaternion& x) const
104{
105 return !(*this == x);
106}
107
109 size_t current_alignment)
110{
111 static_cast<void>(current_alignment);
113}
114
117 size_t current_alignment)
118{
119 (void)data;
120 size_t initial_alignment = current_alignment;
121 current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
122 current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
123 current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
124 current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
125
126 return current_alignment - initial_alignment;
127}
128
130 eprosima::fastcdr::Cdr& scdr) const
131{
132 scdr << m_x;
133 scdr << m_y;
134 scdr << m_z;
135 scdr << m_w;
136}
137
139 eprosima::fastcdr::Cdr& dcdr)
140{
141 dcdr >> m_x;
142 dcdr >> m_y;
143 dcdr >> m_z;
144 dcdr >> m_w;
145}
146
147/*!
148 * @brief This function sets a value in member x
149 * @param _x New value for member x
150 */
152 double _x)
153{
154 m_x = _x;
155}
156
157/*!
158 * @brief This function returns the value of member x
159 * @return Value of member x
160 */
162{
163 return m_x;
164}
165
166/*!
167 * @brief This function returns a reference to member x
168 * @return Reference to member x
169 */
171{
172 return m_x;
173}
174
175/*!
176 * @brief This function sets a value in member y
177 * @param _y New value for member y
178 */
180 double _y)
181{
182 m_y = _y;
183}
184
185/*!
186 * @brief This function returns the value of member y
187 * @return Value of member y
188 */
190{
191 return m_y;
192}
193
194/*!
195 * @brief This function returns a reference to member y
196 * @return Reference to member y
197 */
199{
200 return m_y;
201}
202
203/*!
204 * @brief This function sets a value in member z
205 * @param _z New value for member z
206 */
208 double _z)
209{
210 m_z = _z;
211}
212
213/*!
214 * @brief This function returns the value of member z
215 * @return Value of member z
216 */
218{
219 return m_z;
220}
221
222/*!
223 * @brief This function returns a reference to member z
224 * @return Reference to member z
225 */
227{
228 return m_z;
229}
230
231/*!
232 * @brief This function sets a value in member w
233 * @param _w New value for member w
234 */
236 double _w)
237{
238 m_w = _w;
239}
240
241/*!
242 * @brief This function returns the value of member w
243 * @return Value of member w
244 */
246{
247 return m_w;
248}
249
250/*!
251 * @brief This function returns a reference to member w
252 * @return Reference to member w
253 */
255{
256 return m_w;
257}
258
260 size_t current_alignment)
261{
262 static_cast<void>(current_alignment);
264}
265
267{
268 return false;
269}
270
272 eprosima::fastcdr::Cdr& scdr) const
273{
274 (void) scdr;
275}
#define geometry_msgs_msg_Quaternion_max_cdr_typesize
Definition Imu.cpp:40
#define geometry_msgs_msg_Quaternion_max_key_cdr_typesize
Definition Imu.cpp:46
This class represents the structure Quaternion defined by the user in the IDL file.
Definition Quaternion.h:71
static eProsima_user_DllExport size_t getMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of an object depending on the buffer alignment.
eProsima_user_DllExport ~Quaternion()
Default destructor.
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Quaternion &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
eProsima_user_DllExport double z() const
This function returns the value of member z
eProsima_user_DllExport Quaternion & operator=(const Quaternion &x)
Copy assignment.
eProsima_user_DllExport Quaternion()
Default constructor.
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
eProsima_user_DllExport double y() const
This function returns the value of member y
eProsima_user_DllExport double w() const
This function returns the value of member w
eProsima_user_DllExport double x() const
This function returns the value of member x
eProsima_user_DllExport bool operator==(const Quaternion &x) const
Comparison operator.
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type
static eProsima_user_DllExport size_t getKeyMaxCdrSerializedSize(size_t current_alignment=0)
This function returns the maximum serialized size of the Key of an object depending on the buffer ali...
eProsima_user_DllExport bool operator!=(const Quaternion &x) const
Comparison operator.