// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /*! * @file Topics.cpp * This source file contains the definition of the described types in the IDL file. * * This file was generated by the tool gen. */ #ifdef USE_FASTRTPS #ifdef _WIN32 // Remove linker warning LNK4221 on Visual Studio namespace { char dummy; } #endif #include "Topics.h" #include #include using namespace eprosima::fastcdr::exception; #include TopicSample::Message::Message() { // m_msgname com.eprosima.idl.parser.typecode.StringTypeCode@76329302 m_msgname =""; // m_counter com.eprosima.idl.parser.typecode.PrimitiveTypeCode@5e25a92e m_counter = 0; // m_sendtime com.eprosima.idl.parser.typecode.PrimitiveTypeCode@4df828d7 m_sendtime = 0; // m_xdata com.eprosima.idl.parser.typecode.AliasTypeCode@b59d31 m_xdata.push_back(1); m_xdata.push_back(2); } TopicSample::Message::~Message() { } TopicSample::Message::Message(const Message &x) { m_msgname = x.m_msgname; m_counter = x.m_counter; m_sendtime = x.m_sendtime; m_xdata = x.m_xdata; } TopicSample::Message::Message(Message &&x) { m_msgname = std::move(x.m_msgname); m_counter = x.m_counter; m_sendtime = x.m_sendtime; m_xdata = std::move(x.m_xdata); } TopicSample::Message& TopicSample::Message::operator=(const Message &x) { m_msgname = x.m_msgname; m_counter = x.m_counter; m_sendtime = x.m_sendtime; m_xdata = x.m_xdata; return *this; } TopicSample::Message& TopicSample::Message::operator=(Message &&x) { m_msgname = std::move(x.m_msgname); m_counter = x.m_counter; m_sendtime = x.m_sendtime; m_xdata = std::move(x.m_xdata); return *this; } size_t TopicSample::Message::getMaxCdrSerializedSize(size_t current_alignment) { size_t initial_alignment = current_alignment; current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + 255 + 1; current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); current_alignment += (100 * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); return 10000000; // return current_alignment - initial_alignment; } size_t TopicSample::Message::getCdrSerializedSize(const TopicSample::Message& data, size_t current_alignment) { (void)data; size_t initial_alignment = current_alignment; current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.msgname().size() + 1; current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); current_alignment += 8 + eprosima::fastcdr::Cdr::alignment(current_alignment, 8); current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4); if (data.xdata().size() > 0) { current_alignment += (data.xdata().size() * 1) + eprosima::fastcdr::Cdr::alignment(current_alignment, 1); } return current_alignment - initial_alignment; } void TopicSample::Message::serialize(eprosima::fastcdr::Cdr &scdr) const { scdr << m_msgname; scdr << m_counter; scdr << m_sendtime; scdr << m_xdata; // std::cout<<"serialize."<> m_msgname; dcdr >> m_counter; dcdr >> m_sendtime; dcdr >> m_xdata; } /*! * @brief This function copies the value in member msgname * @param _msgname New value to be copied in member msgname */ void TopicSample::Message::msgname(const std::string &_msgname) { m_msgname = _msgname; } /*! * @brief This function moves the value in member msgname * @param _msgname New value to be moved in member msgname */ void TopicSample::Message::msgname(std::string &&_msgname) { m_msgname = std::move(_msgname); } /*! * @brief This function returns a constant reference to member msgname * @return Constant reference to member msgname */ const std::string& TopicSample::Message::msgname() const { return m_msgname; } /*! * @brief This function returns a reference to member msgname * @return Reference to member msgname */ std::string& TopicSample::Message::msgname() { return m_msgname; } /*! * @brief This function sets a value in member counter * @param _counter New value for member counter */ void TopicSample::Message::counter(int32_t _counter) { m_counter = _counter; } /*! * @brief This function returns the value of member counter * @return Value of member counter */ int32_t TopicSample::Message::counter() const { return m_counter; } /*! * @brief This function returns a reference to member counter * @return Reference to member counter */ int32_t& TopicSample::Message::counter() { return m_counter; } /*! * @brief This function sets a value in member sendtime * @param _sendtime New value for member sendtime */ void TopicSample::Message::sendtime(int64_t _sendtime) { m_sendtime = _sendtime; } /*! * @brief This function returns the value of member sendtime * @return Value of member sendtime */ int64_t TopicSample::Message::sendtime() const { return m_sendtime; } /*! * @brief This function returns a reference to member sendtime * @return Reference to member sendtime */ int64_t& TopicSample::Message::sendtime() { return m_sendtime; } /*! * @brief This function copies the value in member xdata * @param _xdata New value to be copied in member xdata */ void TopicSample::Message::xdata(const TopicSample::SomeBytes &_xdata) { // return; m_xdata = _xdata; //int i; //for(i=0;i<300;i++) // m_xdata.push_back(_xdata.at(i)); } /*! * @brief This function moves the value in member xdata * @param _xdata New value to be moved in member xdata */ void TopicSample::Message::xdata(TopicSample::SomeBytes &&_xdata) { m_xdata = std::move(_xdata); } /*! * @brief This function returns a constant reference to member xdata * @return Constant reference to member xdata */ const TopicSample::SomeBytes& TopicSample::Message::xdata() const { return m_xdata; } /*! * @brief This function returns a reference to member xdata * @return Reference to member xdata */ TopicSample::SomeBytes& TopicSample::Message::xdata() { return m_xdata; } size_t TopicSample::Message::getKeyMaxCdrSerializedSize(size_t current_alignment) { size_t current_align = current_alignment; return current_align; } bool TopicSample::Message::isKeyDefined() { return false; } void TopicSample::Message::serializeKey(eprosima::fastcdr::Cdr &scdr) const { (void) scdr; } #endif