CARLA
 
载入中...
搜索中...
未找到
TF2Error.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 TF2Error.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
29#include "TF2Error.h"
30#include <fastcdr/Cdr.h>
31
32#include <fastcdr/exceptions/BadParamException.h>
33using namespace eprosima::fastcdr::exception;
34
35#include <utility>
36
37#define tf2_msgs_msg_TF2Error_max_cdr_typesize 264ULL;
38#define tf2_msgs_msg_TF2Error_max_key_cdr_typesize 0ULL;
39
41{
42 // octet m_error
43 m_error = 0;
44 // string m_error_string
46}
47
51
53 const TF2Error& x)
54{
55 m_error = x.m_error;
56 m_error_string = x.m_error_string;
57}
58
60 TF2Error&& x) noexcept
61{
62 m_error = x.m_error;
63 m_error_string = std::move(x.m_error_string);
64}
65
67 const TF2Error& x)
68{
69 m_error = x.m_error;
70 m_error_string = x.m_error_string;
71
72 return *this;
73}
74
76 TF2Error&& x) noexcept
77{
78 m_error = x.m_error;
79 m_error_string = std::move(x.m_error_string);
80
81 return *this;
82}
83
85 const TF2Error& x) const
86{
87 return (m_error == x.m_error && m_error_string == x.m_error_string);
88}
89
91 const TF2Error& x) const
92{
93 return !(*this == x);
94}
95
97 size_t current_alignment)
98{
99 static_cast<void>(current_alignment);
101}
102
104 const tf2_msgs::msg::TF2Error& data,
105 size_t current_alignment)
106{
107 size_t initial_alignment = current_alignment;
108 current_alignment += 1 + eprosima::fastcdr::Cdr::alignment(current_alignment, 1);
109 current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.error_string().size() + 1;
110
111 return current_alignment - initial_alignment;
112}
113
115 eprosima::fastcdr::Cdr& scdr) const
116{
117 scdr << m_error;
118 scdr << m_error_string.c_str();
119}
120
122 eprosima::fastcdr::Cdr& dcdr)
123{
124 dcdr >> m_error;
125 dcdr >> m_error_string;
126}
127
128/*!
129 * @brief This function sets a value in member error
130 * @param _error New value for member error
131 */
133 uint8_t _error)
134{
135 m_error = _error;
136}
137
138/*!
139 * @brief This function returns the value of member error
140 * @return Value of member error
141 */
143{
144 return m_error;
145}
146
147/*!
148 * @brief This function returns a reference to member error
149 * @return Reference to member error
150 */
152{
153 return m_error;
154}
155
156/*!
157 * @brief This function copies the value in member error_string
158 * @param _error_string New value to be copied in member error_string
159 */
161 const std::string& _error_string)
162{
163 m_error_string = _error_string;
164}
165
166/*!
167 * @brief This function moves the value in member error_string
168 * @param _error_string New value to be moved in member error_string
169 */
171 std::string&& _error_string)
172{
173 m_error_string = std::move(_error_string);
174}
175
176/*!
177 * @brief This function returns a constant reference to member error_string
178 * @return Constant reference to member error_string
179 */
181{
182 return m_error_string;
183}
184
185/*!
186 * @brief This function returns a reference to member error_string
187 * @return Reference to member error_string
188 */
190{
191 return m_error_string;
192}
193
194
196 size_t current_alignment)
197{
198 static_cast<void>(current_alignment);
200}
201
203{
204 return false;
205}
206
208 eprosima::fastcdr::Cdr& scdr) const
209{
210 (void) scdr;
211}
#define tf2_msgs_msg_TF2Error_max_key_cdr_typesize
Definition TF2Error.cpp:38
#define tf2_msgs_msg_TF2Error_max_cdr_typesize
Definition TF2Error.cpp:37
This class represents the structure TF2Error defined by the user in the IDL file.
Definition TF2Error.h:79
eProsima_user_DllExport bool operator!=(const TF2Error &x) const
Comparison operator.
Definition TF2Error.cpp:90
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 TF2Error.cpp:96
eProsima_user_DllExport TF2Error & operator=(const TF2Error &x)
Copy assignment.
Definition TF2Error.cpp:66
std::string m_error_string
Definition TF2Error.h:235
eProsima_user_DllExport ~TF2Error()
Default destructor.
Definition TF2Error.cpp:48
eProsima_user_DllExport void error_string(const std::string &_error_string)
This function copies the value in member error_string
Definition TF2Error.cpp:160
eProsima_user_DllExport bool operator==(const TF2Error &x) const
Comparison operator.
Definition TF2Error.cpp:84
eProsima_user_DllExport void deserialize(eprosima::fastcdr::Cdr &cdr)
This function deserializes an object using CDR serialization.
Definition TF2Error.cpp:121
eProsima_user_DllExport TF2Error()
Default constructor.
Definition TF2Error.cpp:40
eProsima_user_DllExport void serialize(eprosima::fastcdr::Cdr &cdr) const
This function serializes an object using CDR serialization.
Definition TF2Error.cpp:114
eProsima_user_DllExport uint8_t error() const
This function returns the value of member error
Definition TF2Error.cpp:142
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 TF2Error.cpp:195
eProsima_user_DllExport void serializeKey(eprosima::fastcdr::Cdr &cdr) const
This function serializes the key members of an object using CDR serialization.
Definition TF2Error.cpp:207
eProsima_user_DllExport const std::string & error_string() const
This function returns a constant reference to member error_string
Definition TF2Error.cpp:180
static eProsima_user_DllExport bool isKeyDefined()
This function tells you if the Key has been defined for this type
Definition TF2Error.cpp:202
static eProsima_user_DllExport size_t getCdrSerializedSize(const tf2_msgs::msg::TF2Error &data, size_t current_alignment=0)
This function returns the serialized size of a data depending on the buffer alignment.
Definition TF2Error.cpp:103