CARLA
Vector3.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 Vector3.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 "Vector3.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_Vector3_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 }
49 
51 {
52 }
53 
55  const Vector3& x)
56 {
57  m_x = x.m_x;
58  m_y = x.m_y;
59  m_z = x.m_z;
60 }
61 
63  Vector3&& x) noexcept
64 {
65  m_x = x.m_x;
66  m_y = x.m_y;
67  m_z = x.m_z;
68 }
69 
71  const Vector3& x)
72 {
73 
74  m_x = x.m_x;
75  m_y = x.m_y;
76  m_z = x.m_z;
77 
78  return *this;
79 }
80 
82  Vector3&& x) noexcept
83 {
84  m_x = x.m_x;
85  m_y = x.m_y;
86  m_z = x.m_z;
87 
88  return *this;
89 }
90 
92  const Vector3& x) const
93 {
94  return (m_x == x.m_x && m_y == x.m_y && m_z == x.m_z);
95 }
96 
98  const Vector3& x) const
99 {
100  return !(*this == x);
101 }
102 
104  size_t current_alignment)
105 {
106  static_cast<void>(current_alignment);
108 }
109 
111  const geometry_msgs::msg::Vector3& data,
112  size_t current_alignment)
113 {
114  (void)data;
115  size_t initial_alignment = current_alignment;
116  current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
117  current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
118  current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8);
119 
120  return current_alignment - initial_alignment;
121 }
122 
124  eprosima::fastcdr::Cdr& scdr) const
125 {
126  scdr << m_x;
127  scdr << m_y;
128  scdr << m_z;
129 }
130 
132  eprosima::fastcdr::Cdr& dcdr)
133 {
134  dcdr >> m_x;
135  dcdr >> m_y;
136  dcdr >> m_z;
137 }
138 
139 /*!
140  * @brief This function sets a value in member x
141  * @param _x New value for member x
142  */
144  double _x)
145 {
146  m_x = _x;
147 }
148 
149 /*!
150  * @brief This function returns the value of member x
151  * @return Value of member x
152  */
154 {
155  return m_x;
156 }
157 
158 /*!
159  * @brief This function returns a reference to member x
160  * @return Reference to member x
161  */
163 {
164  return m_x;
165 }
166 
167 /*!
168  * @brief This function sets a value in member y
169  * @param _y New value for member y
170  */
172  double _y)
173 {
174  m_y = _y;
175 }
176 
177 /*!
178  * @brief This function returns the value of member y
179  * @return Value of member y
180  */
182 {
183  return m_y;
184 }
185 
186 /*!
187  * @brief This function returns a reference to member y
188  * @return Reference to member y
189  */
191 {
192  return m_y;
193 }
194 
195 /*!
196  * @brief This function sets a value in member z
197  * @param _z New value for member z
198  */
200  double _z)
201 {
202  m_z = _z;
203 }
204 
205 /*!
206  * @brief This function returns the value of member z
207  * @return Value of member z
208  */
210 {
211  return m_z;
212 }
213 
214 /*!
215  * @brief This function returns a reference to member z
216  * @return Reference to member z
217  */
219 {
220  return m_z;
221 }
222 
224  size_t current_alignment)
225 {
226  static_cast<void>(current_alignment);
228 }
229 
231 {
232  return false;
233 }
234 
236  eprosima::fastcdr::Cdr& scdr) const
237 {
238  (void) scdr;
239 }
#define geometry_msgs_msg_Vector3_max_key_cdr_typesize
Definition: Vector3.cpp:38
eProsima_user_DllExport bool operator==(const Vector3 &x) const
Comparison operator.
Definition: Vector3.cpp:91
eProsima_user_DllExport double z() const
This function returns the value of member z.
Definition: Vector3.cpp:209
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Vector3.cpp:235
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Vector3.cpp:123
#define geometry_msgs_msg_Vector3_max_cdr_typesize
Definition: Vector3.cpp:37
eProsima_user_DllExport ~Vector3()
Default destructor.
Definition: Vector3.cpp:50
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: Vector3.cpp:223
This class represents the structure Vector3 defined by the user in the IDL file.
Definition: Vector3.h:71
eProsima_user_DllExport bool operator!=(const Vector3 &x) const
Comparison operator.
Definition: Vector3.cpp:97
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 deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Vector3.cpp:131
eProsima_user_DllExport Vector3()
Default constructor.
Definition: Vector3.cpp:40
eProsima_user_DllExport Vector3 & operator=(const Vector3 &x)
Copy assignment.
Definition: Vector3.cpp:70
eProsima_user_DllExport double x() const
This function returns the value of member x.
Definition: Vector3.cpp:153
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: Vector3.cpp:103
eProsima_user_DllExport double y() const
This function returns the value of member y.
Definition: Vector3.cpp:181
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Vector3.cpp:230