CARLA
Float32.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 Float32.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 "Float32.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 std_msgs_msg_Float32_max_cdr_typesize 4ULL;
38 #define std_msgs_msg_Float32_max_key_cdr_typesize 0ULL;
39 
41 {
42  m_data = 0.0;
43 }
44 
46 {
47 }
48 
50  const Float32& x)
51 {
52  m_data = x.m_data;
53 }
54 
56  Float32&& x) noexcept
57 {
58  m_data = x.m_data;
59 }
60 
62  const Float32& x)
63 {
64  m_data = x.m_data;
65  return *this;
66 }
67 
69  Float32&& x) noexcept
70 {
71  m_data = x.m_data;
72  return *this;
73 }
74 
76  const Float32& x) const
77 {
78  return (m_data == x.m_data);
79 }
80 
82  const Float32& x) const
83 {
84  return !(*this == x);
85 }
86 
88  size_t current_alignment)
89 {
90  static_cast<void>(current_alignment);
92 }
93 
95  const std_msgs::msg::Float32& data,
96  size_t current_alignment)
97 {
98  (void)data;
99  size_t initial_alignment = current_alignment;
100  current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);
101  return current_alignment - initial_alignment;
102 }
103 
105  eprosima::fastcdr::Cdr& scdr) const
106 {
107  scdr << m_data;
108 }
109 
111  eprosima::fastcdr::Cdr& dcdr)
112 {
113  dcdr >> m_data;
114 }
115 
116 /*!
117  * @brief This function sets a value in member data
118  * @param _data New value for member data
119  */
121  float _data)
122 {
123  m_data = _data;
124 }
125 
126 /*!
127  * @brief This function returns the value of member data
128  * @return Value of member data
129  */
131 {
132  return m_data;
133 }
134 
135 /*!
136  * @brief This function returns a reference to member data
137  * @return Reference to member data
138  */
140 {
141  return m_data;
142 }
143 
145  size_t current_alignment)
146 {
147  static_cast<void>(current_alignment);
149 }
150 
152 {
153  return false;
154 }
155 
157  eprosima::fastcdr::Cdr& scdr) const
158 {
159  (void) scdr;
160 }
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition: Float32.cpp:156
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: Float32.cpp:87
#define std_msgs_msg_Float32_max_key_cdr_typesize
Definition: Float32.cpp:38
This class represents the structure Float32 defined by the user in the IDL file.
Definition: Float32.h:70
eProsima_user_DllExport ~Float32()
Default destructor.
Definition: Float32.cpp:45
static eProsima_user_DllExport size_t getCdrSerializedSize(const std_msgs::msg::Float32 &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition: Float32.cpp:94
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition: Float32.cpp:104
eProsima_user_DllExport Float32 & operator=(const Float32 &x)
Copy assignment.
Definition: Float32.cpp:61
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition: Float32.cpp:110
#define std_msgs_msg_Float32_max_cdr_typesize
Definition: Float32.cpp:37
eProsima_user_DllExport bool operator==(const Float32 &x) const
Comparison operator.
Definition: Float32.cpp:75
eProsima_user_DllExport bool operator!=(const Float32 &x) const
Comparison operator.
Definition: Float32.cpp:81
eProsima_user_DllExport float data() const
This function returns the value of member data.
Definition: Float32.cpp:130
eProsima_user_DllExport Float32()
Default constructor.
Definition: Float32.cpp:40
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: Float32.cpp:144
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type.
Definition: Float32.cpp:151