|
| 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 HelloWorld.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 "HelloWorld.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 HelloWorld_max_cdr_typesize 24ULL; |
| 38 | +#define HelloWorld_max_key_cdr_typesize 0ULL; |
| 39 | + |
| 40 | +HelloWorld::HelloWorld() |
| 41 | +{ |
| 42 | + // unsigned long m_index |
| 43 | + m_index = 0; |
| 44 | + // char m_message |
| 45 | + memset(&m_message, 0, (20) * 1); |
| 46 | + |
| 47 | +} |
| 48 | + |
| 49 | +HelloWorld::~HelloWorld() |
| 50 | +{ |
| 51 | + |
| 52 | + |
| 53 | +} |
| 54 | + |
| 55 | +HelloWorld::HelloWorld( |
| 56 | + const HelloWorld& x) |
| 57 | +{ |
| 58 | + m_index = x.m_index; |
| 59 | + m_message = x.m_message; |
| 60 | +} |
| 61 | + |
| 62 | +HelloWorld::HelloWorld( |
| 63 | + HelloWorld&& x) noexcept |
| 64 | +{ |
| 65 | + m_index = x.m_index; |
| 66 | + m_message = std::move(x.m_message); |
| 67 | +} |
| 68 | + |
| 69 | +HelloWorld& HelloWorld::operator =( |
| 70 | + const HelloWorld& x) |
| 71 | +{ |
| 72 | + |
| 73 | + m_index = x.m_index; |
| 74 | + m_message = x.m_message; |
| 75 | + |
| 76 | + return *this; |
| 77 | +} |
| 78 | + |
| 79 | +HelloWorld& HelloWorld::operator =( |
| 80 | + HelloWorld&& x) noexcept |
| 81 | +{ |
| 82 | + |
| 83 | + m_index = x.m_index; |
| 84 | + m_message = std::move(x.m_message); |
| 85 | + |
| 86 | + return *this; |
| 87 | +} |
| 88 | + |
| 89 | +bool HelloWorld::operator ==( |
| 90 | + const HelloWorld& x) const |
| 91 | +{ |
| 92 | + |
| 93 | + return (m_index == x.m_index && m_message == x.m_message); |
| 94 | +} |
| 95 | + |
| 96 | +bool HelloWorld::operator !=( |
| 97 | + const HelloWorld& x) const |
| 98 | +{ |
| 99 | + return !(*this == x); |
| 100 | +} |
| 101 | + |
| 102 | +size_t HelloWorld::getMaxCdrSerializedSize( |
| 103 | + size_t current_alignment) |
| 104 | +{ |
| 105 | + static_cast<void>(current_alignment); |
| 106 | + return HelloWorld_max_cdr_typesize; |
| 107 | +} |
| 108 | + |
| 109 | +size_t HelloWorld::getCdrSerializedSize( |
| 110 | + const HelloWorld& data, |
| 111 | + size_t current_alignment) |
| 112 | +{ |
| 113 | + (void)data; |
| 114 | + size_t initial_alignment = current_alignment; |
| 115 | + |
| 116 | + |
| 117 | + current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); |
| 118 | + |
| 119 | + |
| 120 | + current_alignment += ((20) * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); |
| 121 | + |
| 122 | + |
| 123 | + return current_alignment - initial_alignment; |
| 124 | +} |
| 125 | + |
| 126 | +void HelloWorld::serialize( |
| 127 | + eprosima::fastcdr::Cdr& scdr) const |
| 128 | +{ |
| 129 | + |
| 130 | + scdr << m_index; |
| 131 | + scdr << m_message; |
| 132 | + |
| 133 | + |
| 134 | +} |
| 135 | + |
| 136 | +void HelloWorld::deserialize( |
| 137 | + eprosima::fastcdr::Cdr& dcdr) |
| 138 | +{ |
| 139 | + |
| 140 | + dcdr >> m_index; |
| 141 | + dcdr >> m_message; |
| 142 | + |
| 143 | +} |
| 144 | + |
| 145 | +/*! |
| 146 | + * @brief This function sets a value in member index |
| 147 | + * @param _index New value for member index |
| 148 | + */ |
| 149 | +void HelloWorld::index( |
| 150 | + uint32_t _index) |
| 151 | +{ |
| 152 | + m_index = _index; |
| 153 | +} |
| 154 | + |
| 155 | +/*! |
| 156 | + * @brief This function returns the value of member index |
| 157 | + * @return Value of member index |
| 158 | + */ |
| 159 | +uint32_t HelloWorld::index() const |
| 160 | +{ |
| 161 | + return m_index; |
| 162 | +} |
| 163 | + |
| 164 | +/*! |
| 165 | + * @brief This function returns a reference to member index |
| 166 | + * @return Reference to member index |
| 167 | + */ |
| 168 | +uint32_t& HelloWorld::index() |
| 169 | +{ |
| 170 | + return m_index; |
| 171 | +} |
| 172 | + |
| 173 | +/*! |
| 174 | + * @brief This function copies the value in member message |
| 175 | + * @param _message New value to be copied in member message |
| 176 | + */ |
| 177 | +void HelloWorld::message( |
| 178 | + const std::array<char, 20>& _message) |
| 179 | +{ |
| 180 | + m_message = _message; |
| 181 | +} |
| 182 | + |
| 183 | +/*! |
| 184 | + * @brief This function moves the value in member message |
| 185 | + * @param _message New value to be moved in member message |
| 186 | + */ |
| 187 | +void HelloWorld::message( |
| 188 | + std::array<char, 20>&& _message) |
| 189 | +{ |
| 190 | + m_message = std::move(_message); |
| 191 | +} |
| 192 | + |
| 193 | +/*! |
| 194 | + * @brief This function returns a constant reference to member message |
| 195 | + * @return Constant reference to member message |
| 196 | + */ |
| 197 | +const std::array<char, 20>& HelloWorld::message() const |
| 198 | +{ |
| 199 | + return m_message; |
| 200 | +} |
| 201 | + |
| 202 | +/*! |
| 203 | + * @brief This function returns a reference to member message |
| 204 | + * @return Reference to member message |
| 205 | + */ |
| 206 | +std::array<char, 20>& HelloWorld::message() |
| 207 | +{ |
| 208 | + return m_message; |
| 209 | +} |
| 210 | + |
| 211 | +size_t HelloWorld::getKeyMaxCdrSerializedSize( |
| 212 | + size_t current_alignment) |
| 213 | +{ |
| 214 | + static_cast<void>(current_alignment); |
| 215 | + return HelloWorld_max_key_cdr_typesize; |
| 216 | +} |
| 217 | + |
| 218 | +bool HelloWorld::isKeyDefined() |
| 219 | +{ |
| 220 | + return false; |
| 221 | +} |
| 222 | + |
| 223 | +void HelloWorld::serializeKey( |
| 224 | + eprosima::fastcdr::Cdr& scdr) const |
| 225 | +{ |
| 226 | + (void) scdr; |
| 227 | +} |
0 commit comments