CARLA
 
载入中...
搜索中...
未找到
CarlaEgoVehicleControl.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 CarlaEgoCarlaEgoVehicleControl.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
30#include <fastcdr/Cdr.h>
31
32#include <fastcdr/exceptions/BadParamException.h>
33using namespace eprosima::fastcdr::exception;
34
35#include <utility>
36
37#define builtin_interfaces_msg_Time_max_cdr_typesize 8ULL;
38#define std_msgs_msg_Header_max_cdr_typesize 268ULL;
39#define carla_msgs_msg_CarlaEgoVehicleControl_max_cdr_typesize 289ULL;
40#define builtin_interfaces_msg_Time_max_key_cdr_typesize 0ULL;
41#define std_msgs_msg_Header_max_key_cdr_typesize 0ULL;
42#define carla_msgs_msg_CarlaEgoVehicleControl_max_key_cdr_typesize 0ULL;
43
45{
46 // std_msgs::msg::Header m_header
47
48 // float m_throttle
49 m_throttle = 0.0;
50 // float m_steer
51 m_steer = 0.0;
52 // float m_brake
53 m_brake = 0.0;
54 // boolean m_hand_brake
55 m_hand_brake = false;
56 // boolean m_reverse
57 m_reverse = false;
58 // long m_gear
59 m_gear = 0;
60 // boolean m_manual_gear_shift
61 m_manual_gear_shift = false;
62
63}
64
68
71{
72 m_header = x.m_header;
73 m_throttle = x.m_throttle;
74 m_steer = x.m_steer;
75 m_brake = x.m_brake;
76 m_hand_brake = x.m_hand_brake;
77 m_reverse = x.m_reverse;
78 m_gear = x.m_gear;
79 m_manual_gear_shift = x.m_manual_gear_shift;
80}
81
83 CarlaEgoVehicleControl&& x) noexcept
84{
85 m_header = std::move(x.m_header);
86 m_throttle = x.m_throttle;
87 m_steer = x.m_steer;
88 m_brake = x.m_brake;
89 m_hand_brake = x.m_hand_brake;
90 m_reverse = x.m_reverse;
91 m_gear = x.m_gear;
92 m_manual_gear_shift = x.m_manual_gear_shift;
93}
94
97{
98 m_header = x.m_header;
99 m_throttle = x.m_throttle;
100 m_steer = x.m_steer;
101 m_brake = x.m_brake;
102 m_hand_brake = x.m_hand_brake;
103 m_reverse = x.m_reverse;
104 m_gear = x.m_gear;
105 m_manual_gear_shift = x.m_manual_gear_shift;
106
107 return *this;
108}
109
111 CarlaEgoVehicleControl&& x) noexcept
112{
113 m_header = std::move(x.m_header);
114 m_throttle = x.m_throttle;
115 m_steer = x.m_steer;
116 m_brake = x.m_brake;
117 m_hand_brake = x.m_hand_brake;
118 m_reverse = x.m_reverse;
119 m_gear = x.m_gear;
120 m_manual_gear_shift = x.m_manual_gear_shift;
121
122 return *this;
123}
124
126 const CarlaEgoVehicleControl& x) const
127{
128 return (m_header == x.m_header && m_throttle == x.m_throttle && m_steer == x.m_steer && m_brake == x.m_brake && m_hand_brake == x.m_hand_brake && m_reverse == x.m_reverse && m_gear == x.m_gear && m_manual_gear_shift == x.m_manual_gear_shift);
129}
130
132 const CarlaEgoVehicleControl& x) const
133{
134 return !(*this == x);
135}
136
138 size_t current_alignment)
139{
140 static_cast<void>(current_alignment);
142}
143
146 size_t current_alignment)
147{
148 size_t initial_alignment = current_alignment;
149 current_alignment += std_msgs::msg::Header::getCdrSerializedSize(data.header(), current_alignment);
150 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
151 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
152 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
153 current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
154 current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
155 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
156 current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
157 return current_alignment - initial_alignment;
158}
159
161 eprosima::fastcdr::Cdr& scdr) const
162{
163 scdr << m_header;
164 scdr << m_throttle;
165 scdr << m_steer;
166 scdr << m_brake;
167 scdr << m_hand_brake;
168 scdr << m_reverse;
169 scdr << m_gear;
170 scdr << m_manual_gear_shift;
171}
172
174 eprosima::fastcdr::Cdr& dcdr)
175{
176 dcdr >> m_header;
177 dcdr >> m_throttle;
178 dcdr >> m_steer;
179 dcdr >> m_brake;
180 dcdr >> m_hand_brake;
181 dcdr >> m_reverse;
182 dcdr >> m_gear;
183 dcdr >> m_manual_gear_shift;
184}
185
186/*!
187 * @brief This function copies the value in member header
188 * @param _header New value to be copied in member header
189 */
191 const std_msgs::msg::Header& _header)
192{
193 m_header = _header;
194}
195
196/*!
197 * @brief This function moves the value in member header
198 * @param _header New value to be moved in member header
199 */
201 std_msgs::msg::Header&& _header)
202{
203 m_header = std::move(_header);
204}
205
206/*!
207 * @brief This function returns a constant reference to member header
208 * @return Constant reference to member header
209 */
211{
212 return m_header;
213}
214
215/*!
216 * @brief This function returns a reference to member header
217 * @return Reference to member header
218 */
223/*!
224 * @brief This function sets a value in member throttle
225 * @param _throttle New value for member throttle
226 */
228 float _throttle)
229{
230 m_throttle = _throttle;
231}
232
233/*!
234 * @brief This function returns the value of member throttle
235 * @return Value of member throttle
236 */
238{
239 return m_throttle;
240}
241
242/*!
243 * @brief This function returns a reference to member throttle
244 * @return Reference to member throttle
245 */
247{
248 return m_throttle;
249}
250
251/*!
252 * @brief This function sets a value in member steer
253 * @param _steer New value for member steer
254 */
256 float _steer)
257{
258 m_steer = _steer;
259}
260
261/*!
262 * @brief This function returns the value of member steer
263 * @return Value of member steer
264 */
266{
267 return m_steer;
268}
269
270/*!
271 * @brief This function returns a reference to member steer
272 * @return Reference to member steer
273 */
275{
276 return m_steer;
277}
278
279/*!
280 * @brief This function sets a value in member brake
281 * @param _brake New value for member brake
282 */
284 float _brake)
285{
286 m_brake = _brake;
287}
288
289/*!
290 * @brief This function returns the value of member brake
291 * @return Value of member brake
292 */
294{
295 return m_brake;
296}
297
298/*!
299 * @brief This function returns a reference to member brake
300 * @return Reference to member brake
301 */
303{
304 return m_brake;
305}
306
307/*!
308 * @brief This function sets a value in member hand_brake
309 * @param _hand_brake New value for member hand_brake
310 */
312 bool _hand_brake)
313{
314 m_hand_brake = _hand_brake;
315}
316
317/*!
318 * @brief This function returns the value of member hand_brake
319 * @return Value of member hand_brake
320 */
322{
323 return m_hand_brake;
324}
325
326/*!
327 * @brief This function returns a reference to member hand_brake
328 * @return Reference to member hand_brake
329 */
331{
332 return m_hand_brake;
333}
334
335/*!
336 * @brief This function sets a value in member reverse
337 * @param _reverse New value for member reverse
338 */
340 bool _reverse)
341{
342 m_reverse = _reverse;
343}
344
345/*!
346 * @brief This function returns the value of member reverse
347 * @return Value of member reverse
348 */
350{
351 return m_reverse;
352}
353
354/*!
355 * @brief This function returns a reference to member reverse
356 * @return Reference to member reverse
357 */
359{
360 return m_reverse;
361}
362
363/*!
364 * @brief This function sets a value in member gear
365 * @param _gear New value for member gear
366 */
368 int32_t _gear)
369{
370 m_gear = _gear;
371}
372
373/*!
374 * @brief This function returns the value of member gear
375 * @return Value of member gear
376 */
378{
379 return m_gear;
380}
381
382/*!
383 * @brief This function returns a reference to member gear
384 * @return Reference to member gear
385 */
387{
388 return m_gear;
389}
390
391/*!
392 * @brief This function sets a value in member manual_gear_shift
393 * @param _manual_gear_shift New value for member manual_gear_shift
394 */
396 bool _manual_gear_shift)
397{
398 m_manual_gear_shift = _manual_gear_shift;
399}
400
401/*!
402 * @brief This function returns the value of member manual_gear_shift
403 * @return Value of member manual_gear_shift
404 */
406{
407 return m_manual_gear_shift;
408}
409
410/*!
411 * @brief This function returns a reference to member manual_gear_shift
412 * @return Reference to member manual_gear_shift
413 */
415{
416 return m_manual_gear_shift;
417}
418
420 size_t current_alignment)
421{
422 static_cast<void>(current_alignment);
424}
425
430
432 eprosima::fastcdr::Cdr& scdr) const
433{
434 (void) scdr;
435}
#define carla_msgs_msg_CarlaEgoVehicleControl_max_key_cdr_typesize
#define carla_msgs_msg_CarlaEgoVehicleControl_max_cdr_typesize
This class represents the structure CarlaEgoVehicleControl defined by the user in the IDL file.
static eProsima_user_DllExport size_t getCdrSerializedSize(const carla_msgs::msg::CarlaEgoVehicleControl &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
eProsima_user_DllExport float brake() const
This function returns the value of member brake
eProsima_user_DllExport float steer() const
This function returns the value of member steer
eProsima_user_DllExport ~CarlaEgoVehicleControl()
Default destructor.
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
eProsima_user_DllExport int32_t gear() const
This function returns the value of member gear
eProsima_user_DllExport bool operator==(const CarlaEgoVehicleControl &x) const
Comparison operator.
eProsima_user_DllExport bool hand_brake() const
This function returns the value of member hand_brake
eProsima_user_DllExport CarlaEgoVehicleControl & operator=(const CarlaEgoVehicleControl &x)
Copy assignment.
eProsima_user_DllExport CarlaEgoVehicleControl()
Default constructor.
eProsima_user_DllExport const std_msgs::msg::Header & header() const
This function returns a constant reference to member header
eProsima_user_DllExport float throttle() const
This function returns the value of member throttle
eProsima_user_DllExport bool reverse() const
This function returns the value of member reverse
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 void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
eProsima_user_DllExport bool operator!=(const CarlaEgoVehicleControl &x) const
Comparison operator.
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type
eProsima_user_DllExport bool manual_gear_shift() const
This function returns the value of member manual_gear_shift
eProsima_user_DllExport void header(const std_msgs::msg::Header &_header)
This function copies the value in member header
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...
This class represents the structure Header defined by the user in the IDL file.
Definition Header.h:73
static eProsima_user_DllExport size_t getCdrSerializedSize(const std_msgs::msg::Header &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition Header.cpp:102