CARLA
Twist.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 Twist.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 "Twist.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_Twist_max_cdr_typesize 48ULL;
39 #define geometry_msgs_msg_Vector3_max_key_cdr_typesize 0ULL;
40 #define geometry_msgs_msg_Twist_max_key_cdr_typesize 0ULL;
41 
43 {
44 }
45 
47 {
48 }
49 
51  const Twist& x)
52 {
53  m_linear = x.m_linear;
54  m_angular = x.m_angular;
55 }
56 
58  Twist&& x) noexcept
59 {
60  m_linear = std::move(x.m_linear);
61  m_angular = std::move(x.m_angular);
62 }
63 
65  const Twist& x)
66 {
67  m_linear = x.m_linear;
68  m_angular = x.m_angular;
69 
70  return *this;
71 }
72 
74  Twist&& x) noexcept
75 {
76  m_linear = std::move(x.m_linear);
77  m_angular = std::move(x.m_angular);
78 
79  return *this;
80 }
81 
83  const Twist& x) const
84 {
85  return (m_linear == x.m_linear && m_angular == x.m_angular);
86 }
87 
89  const Twist& x) const
90 {
91  return !(*this == x);
92 }
93 
95  size_t current_alignment)
96 {
97  static_cast<void>(current_alignment);
99 }
100 
102  const geometry_msgs::msg::Twist& data,
103  size_t current_alignment)
104 {
105  size_t initial_alignment = current_alignment;
106  current_alignment += geometry_msgs::msg::Vector3::getCdrSerializedSize(data.linear(), current_alignment);
107  current_alignment += geometry_msgs::msg::Vector3::getCdrSerializedSize(data.angular(), current_alignment);
108 
109  return current_alignment - initial_alignment;
110 }
111 
113  eprosima::fastcdr::Cdr& scdr) const
114 {
115  scdr << m_linear;
116  scdr << m_angular;
117 }
118 
120  eprosima::fastcdr::Cdr& dcdr)
121 {
122  dcdr >> m_linear;
123  dcdr >> m_angular;
124 }
125 
126 /*!
127  * @brief This function copies the value in member linear
128  * @param _linear New value to be copied in member linear
129  */
131  const geometry_msgs::msg::Vector3& _linear)
132 {
133  m_linear = _linear;
134 }
135 
136 /*!
137  * @brief This function moves the value in member linear
138  * @param _linear New value to be moved in member linear
139  */
141  geometry_msgs::msg::Vector3&& _linear)
142 {
143  m_linear = std::move(_linear);
144 }
145 
146 /*!
147  * @brief This function returns a constant reference to member linear
148  * @return Constant reference to member linear
149  */
151 {
152  return m_linear;
153 }
154 
155 /*!
156  * @brief This function returns a reference to member linear
157  * @return Reference to member linear
158  */
160 {
161  return m_linear;
162 }
163 
164 /*!
165  * @brief This function copies the value in member angular
166  * @param _angular New value to be copied in member angular
167  */
169  const geometry_msgs::msg::Vector3& _angular)
170 {
171  m_angular = _angular;
172 }
173 
174 /*!
175  * @brief This function moves the value in member angular
176  * @param _angular New value to be moved in member angular
177  */
179  geometry_msgs::msg::Vector3&& _angular)
180 {
181  m_angular = std::move(_angular);
182 }
183 
184 /*!
185  * @brief This function returns a constant reference to member angular
186  * @return Constant reference to member angular
187  */
189 {
190  return m_angular;
191 }
192 
193 /*!
194  * @brief This function returns a reference to member angular
195  * @return Reference to member angular
196  */
198 {
199  return m_angular;
200 }
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 }
geometry_msgs::msg::Vector3 m_angular
Definition: Twist.h:235
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Twist.cpp:215
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Twist.cpp:119
#define geometry_msgs_msg_Twist_max_cdr_typesize
Definition: Twist.cpp:38
eProsima_user_DllExport ~Twist()
Default destructor.
Definition: Twist.cpp:46
eProsima_user_DllExport bool operator!=(const Twist &x) const
Comparison operator.
Definition: Twist.cpp:88
This class represents the structure Twist defined by the user in the IDL file.
Definition: Twist.h:72
eProsima_user_DllExport const geometry_msgs::msg::Vector3 & linear() const
This function returns a constant reference to member linear.
Definition: Twist.cpp:150
eProsima_user_DllExport Twist & operator=(const Twist &x)
Copy assignment.
Definition: Twist.cpp:64
#define geometry_msgs_msg_Twist_max_key_cdr_typesize
Definition: Twist.cpp:40
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: Twist.cpp:94
This class represents the structure Vector3 defined by the user in the IDL file.
Definition: Vector3.h:71
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Twist.cpp:112
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: Twist.cpp:203
eProsima_user_DllExport const geometry_msgs::msg::Vector3 & angular() const
This function returns a constant reference to member angular.
Definition: Twist.cpp:188
static eProsima_user_DllExport size_t getCdrSerializedSize(const geometry_msgs::msg::Twist &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Twist.cpp:101
eProsima_user_DllExport bool operator==(const Twist &x) const
Comparison operator.
Definition: Twist.cpp:82
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
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Twist.cpp:210
eProsima_user_DllExport void linear(const geometry_msgs::msg::Vector3 &_linear)
This function copies the value in member linear.
Definition: Twist.cpp:130
eProsima_user_DllExport Twist()
Default constructor.
Definition: Twist.cpp:42
eProsima_user_DllExport void angular(const geometry_msgs::msg::Vector3 &_angular)
This function copies the value in member angular.
Definition: Twist.cpp:168
geometry_msgs::msg::Vector3 m_linear
Definition: Twist.h:234