CARLA
Transform.cpp
Go to the documentation of this file.
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 Transform.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
24 namespace {
25 char dummy;
26 } // namespace
27 #endif // _WIN32
28 
29 #include "Transform.h"
30 #include <fastcdr/Cdr.h>
31 
32 #include <fastcdr/exceptions/BadParamException.h>
33 using namespace eprosima::fastcdr::exception;
34 
35 #include <utility>
36 
37 #define geometry_msgs_msg_Vector3_max_cdr_typesize 24ULL;
38 #define geometry_msgs_msg_Transform_max_cdr_typesize 56ULL;
39 #define geometry_msgs_msg_Quaternion_max_cdr_typesize 32ULL;
40 #define geometry_msgs_msg_Vector3_max_key_cdr_typesize 0ULL;
41 #define geometry_msgs_msg_Transform_max_key_cdr_typesize 0ULL;
42 #define geometry_msgs_msg_Quaternion_max_key_cdr_typesize 0ULL;
43 
45 {
46 }
47 
49 {
50 }
51 
53  const Transform& x)
54 {
55  m_translation = x.m_translation;
56  m_rotation = x.m_rotation;
57 }
58 
60  Transform&& x) noexcept
61 {
62  m_translation = std::move(x.m_translation);
63  m_rotation = std::move(x.m_rotation);
64 }
65 
67  const Transform& x)
68 {
69  m_translation = x.m_translation;
70  m_rotation = x.m_rotation;
71 
72  return *this;
73 }
74 
76  Transform&& x) noexcept
77 {
78  m_translation = std::move(x.m_translation);
79  m_rotation = std::move(x.m_rotation);
80 
81  return *this;
82 }
83 
85  const Transform& x) const
86 {
87  return (m_translation == x.m_translation && m_rotation == x.m_rotation);
88 }
89 
91  const Transform& x) const
92 {
93  return !(*this == x);
94 }
95 
97  size_t current_alignment)
98 {
99  static_cast<void>(current_alignment);
101 }
102 
104  const geometry_msgs::msg::Transform& data,
105  size_t current_alignment)
106 {
107  size_t initial_alignment = current_alignment;
108  current_alignment += geometry_msgs::msg::Vector3::getCdrSerializedSize(data.translation(), current_alignment);
109  current_alignment += geometry_msgs::msg::Quaternion::getCdrSerializedSize(data.rotation(), current_alignment);
110 
111  return current_alignment - initial_alignment;
112 }
113 
115  eprosima::fastcdr::Cdr& scdr) const
116 {
117  scdr << m_translation;
118  scdr << m_rotation;
119 }
120 
122  eprosima::fastcdr::Cdr& dcdr)
123 {
124  dcdr >> m_translation;
125  dcdr >> m_rotation;
126 }
127 
128 /*!
129  * @brief This function copies the value in member translation
130  * @param _translation New value to be copied in member translation
131  */
133  const geometry_msgs::msg::Vector3& _translation)
134 {
135  m_translation = _translation;
136 }
137 
138 /*!
139  * @brief This function moves the value in member translation
140  * @param _translation New value to be moved in member translation
141  */
143  geometry_msgs::msg::Vector3&& _translation)
144 {
145  m_translation = std::move(_translation);
146 }
147 
148 /*!
149  * @brief This function returns a constant reference to member translation
150  * @return Constant reference to member translation
151  */
153 {
154  return m_translation;
155 }
156 
157 /*!
158  * @brief This function returns a reference to member translation
159  * @return Reference to member translation
160  */
162 {
163  return m_translation;
164 }
165 /*!
166  * @brief This function copies the value in member rotation
167  * @param _rotation New value to be copied in member rotation
168  */
170  const geometry_msgs::msg::Quaternion& _rotation)
171 {
172  m_rotation = _rotation;
173 }
174 
175 /*!
176  * @brief This function moves the value in member rotation
177  * @param _rotation New value to be moved in member rotation
178  */
180  geometry_msgs::msg::Quaternion&& _rotation)
181 {
182  m_rotation = std::move(_rotation);
183 }
184 
185 /*!
186  * @brief This function returns a constant reference to member rotation
187  * @return Constant reference to member rotation
188  */
190 {
191  return m_rotation;
192 }
193 
194 /*!
195  * @brief This function returns a reference to member rotation
196  * @return Reference to member rotation
197  */
199 {
200  return m_rotation;
201 }
202 
204  size_t current_alignment)
205 {
206  static_cast<void>(current_alignment);
208 }
209 
211 {
212  return false;
213 }
214 
216  eprosima::fastcdr::Cdr& scdr) const
217 {
218  (void) scdr;
219 }
#define geometry_msgs_msg_Transform_max_key_cdr_typesize
Definition: Transform.cpp:41
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Transform.cpp:121
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Transform.cpp:114
geometry_msgs::msg::Quaternion m_rotation
geometry_msgs::msg::Vector3 m_translation
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.
Definition: Quaternion.cpp:115
#define geometry_msgs_msg_Transform_max_cdr_typesize
Definition: Transform.cpp:38
eProsima_user_DllExport ~Transform()
Default destructor.
Definition: Transform.cpp:48
eProsima_user_DllExport void translation(const geometry_msgs::msg::Vector3 &_translation)
This function copies the value in member translation.
Definition: Transform.cpp:132
This class represents the structure Vector3 defined by the user in the IDL file.
Definition: Vector3.h:71
This class represents the structure Transform defined by the user in the IDL file.
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Transform &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Transform.cpp:103
eProsima_user_DllExport bool operator!=(const Transform &x) const
Comparison operator.
Definition: Transform.cpp:90
eProsima_user_DllExport Transform & operator=(const Transform &x)
Copy assignment.
Definition: Transform.cpp:66
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Vector3 &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Vector3.cpp:110
eProsima_user_DllExport void rotation(const geometry_msgs::msg::Quaternion &_rotation)
This function copies the value in member rotation.
Definition: Transform.cpp:169
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...
Definition: Transform.cpp:96
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...
Definition: Transform.cpp:203
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Transform.cpp:210
eProsima_user_DllExport Transform()
Default constructor.
Definition: Transform.cpp:44
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Transform.cpp:215
eProsima_user_DllExport const geometry_msgs::msg::Vector3 & translation() const
This function returns a constant reference to member translation.
Definition: Transform.cpp:152
This class represents the structure Quaternion defined by the user in the IDL file.
Definition: Quaternion.h:70
eProsima_user_DllExport bool operator==(const Transform &x) const
Comparison operator.
Definition: Transform.cpp:84
eProsima_user_DllExport const geometry_msgs::msg::Quaternion & rotation() const
This function returns a constant reference to member rotation.
Definition: Transform.cpp:189