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