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