Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[19453] Regenerate types using Fast DDS-Gen v3.0.0 #206

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 9 additions & 72 deletions examples/cpp/HelloWorldExample/HelloWorld.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

/*!
* @file HelloWorld.cpp
* This source file contains the definition of the described types in the IDL file.
* This source file contains the implementation of the described types in the IDL file.
*
* This file was generated by the tool gen.
* This file was generated by the tool fastddsgen.
*/

#ifdef _WIN32
Expand All @@ -29,27 +29,20 @@ char dummy;
#include "HelloWorld.h"
#include <fastcdr/Cdr.h>


#include <fastcdr/exceptions/BadParamException.h>
using namespace eprosima::fastcdr::exception;

#include <utility>

#define HelloWorld_max_cdr_typesize 264ULL;
#define HelloWorld_max_key_cdr_typesize 0ULL;

HelloWorld::HelloWorld()
{
// unsigned long m_index
m_index = 0;
// string m_message
m_message ="";

}

HelloWorld::~HelloWorld()
{


}

HelloWorld::HelloWorld(
Expand All @@ -60,7 +53,7 @@ HelloWorld::HelloWorld(
}

HelloWorld::HelloWorld(
HelloWorld&& x) noexcept
HelloWorld&& x) noexcept
{
m_index = x.m_index;
m_message = std::move(x.m_message);
Expand Down Expand Up @@ -89,8 +82,8 @@ HelloWorld& HelloWorld::operator =(
bool HelloWorld::operator ==(
const HelloWorld& x) const
{

return (m_index == x.m_index && m_message == x.m_message);
return (m_index == x.m_index &&
m_message == x.m_message);
}

bool HelloWorld::operator !=(
Expand All @@ -99,47 +92,6 @@ bool HelloWorld::operator !=(
return !(*this == x);
}

size_t HelloWorld::getMaxCdrSerializedSize(
size_t current_alignment)
{
static_cast<void>(current_alignment);
return HelloWorld_max_cdr_typesize;
}

size_t HelloWorld::getCdrSerializedSize(
const HelloWorld& data,
size_t current_alignment)
{
(void)data;
size_t initial_alignment = current_alignment;


current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4);


current_alignment += 4 + eprosima::fastcdr::Cdr::alignment(current_alignment, 4) + data.message().size() + 1;


return current_alignment - initial_alignment;
}

void HelloWorld::serialize(
eprosima::fastcdr::Cdr& scdr) const
{

scdr << m_index;
scdr << m_message.c_str();

}

void HelloWorld::deserialize(
eprosima::fastcdr::Cdr& dcdr)
{

dcdr >> m_index;
dcdr >> m_message;
}

/*!
* @brief This function sets a value in member index
* @param _index New value for member index
Expand Down Expand Up @@ -168,6 +120,7 @@ uint32_t& HelloWorld::index()
return m_index;
}


/*!
* @brief This function copies the value in member message
* @param _message New value to be copied in member message
Expand Down Expand Up @@ -207,21 +160,5 @@ std::string& HelloWorld::message()
}


size_t HelloWorld::getKeyMaxCdrSerializedSize(
size_t current_alignment)
{
static_cast<void>(current_alignment);
return HelloWorld_max_key_cdr_typesize;
}

bool HelloWorld::isKeyDefined()
{
return false;
}

void HelloWorld::serializeKey(
eprosima::fastcdr::Cdr& scdr) const
{
(void) scdr;
}

// Include auxiliary functions like for serializing/deserializing.
#include "HelloWorldCdrAux.ipp"
78 changes: 13 additions & 65 deletions examples/cpp/HelloWorldExample/HelloWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,23 @@
* @file HelloWorld.h
* This header file contains the declaration of the described types in the IDL file.
*
* This file was generated by the tool gen.
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_
#define _FAST_DDS_GENERATED_HELLOWORLD_H_


#include <fastrtps/utils/fixed_size_string.hpp>

#include <stdint.h>
#include <array>
#include <bitset>
#include <cstdint>
#include <map>
#include <string>
#include <vector>
#include <map>
#include <bitset>

#include <fastcdr/cdr/fixed_size_string.hpp>
#include <fastcdr/xcdr/optional.hpp>



#if defined(_WIN32)
#if defined(EPROSIMA_USER_DLL_EXPORT)
Expand Down Expand Up @@ -59,10 +61,12 @@
namespace eprosima {
namespace fastcdr {
class Cdr;
class CdrSizeCalculator;
} // namespace fastcdr
} // namespace eprosima



/*!
* @brief This class represents the structure HelloWorld defined by the user in the IDL file.
* @ingroup HelloWorld
Expand Down Expand Up @@ -142,6 +146,7 @@ class HelloWorld
*/
eProsima_user_DllExport uint32_t& index();


/*!
* @brief This function copies the value in member message
* @param _message New value to be copied in member message
Expand All @@ -168,66 +173,9 @@ class HelloWorld
*/
eProsima_user_DllExport std::string& message();

/*!
* @brief This function returns the maximum serialized size of an object
* depending on the buffer alignment.
* @param current_alignment Buffer alignment.
* @return Maximum serialized size.
*/
eProsima_user_DllExport static size_t getMaxCdrSerializedSize(
size_t current_alignment = 0);

/*!
* @brief This function returns the serialized size of a data depending on the buffer alignment.
* @param data Data which is calculated its serialized size.
* @param current_alignment Buffer alignment.
* @return Serialized size.
*/
eProsima_user_DllExport static size_t getCdrSerializedSize(
const HelloWorld& data,
size_t current_alignment = 0);


/*!
* @brief This function serializes an object using CDR serialization.
* @param cdr CDR serialization object.
*/
eProsima_user_DllExport void serialize(
eprosima::fastcdr::Cdr& cdr) const;

/*!
* @brief This function deserializes an object using CDR serialization.
* @param cdr CDR serialization object.
*/
eProsima_user_DllExport void deserialize(
eprosima::fastcdr::Cdr& cdr);



/*!
* @brief This function returns the maximum serialized size of the Key of an object
* depending on the buffer alignment.
* @param current_alignment Buffer alignment.
* @return Maximum serialized size.
*/
eProsima_user_DllExport static size_t getKeyMaxCdrSerializedSize(
size_t current_alignment = 0);

/*!
* @brief This function tells you if the Key has been defined for this type
*/
eProsima_user_DllExport static bool isKeyDefined();

/*!
* @brief This function serializes the key members of an object using CDR serialization.
* @param cdr CDR serialization object.
*/
eProsima_user_DllExport void serializeKey(
eprosima::fastcdr::Cdr& cdr) const;

private:

uint32_t m_index;
uint32_t m_index{0};
std::string m_message;

};
Expand Down
1 change: 1 addition & 0 deletions examples/cpp/HelloWorldExample/HelloWorld.idl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@final
struct HelloWorld
{
unsigned long index;
Expand Down
45 changes: 45 additions & 0 deletions examples/cpp/HelloWorldExample/HelloWorldCdrAux.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// 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 HelloWorldCdrAux.hpp
* This source file contains some definitions of CDR related functions.
*
* This file was generated by the tool fastddsgen.
*/

#ifndef _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
#define _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_

#include "HelloWorld.h"

constexpr uint32_t HelloWorld_max_cdr_typesize {264UL};
constexpr uint32_t HelloWorld_max_key_cdr_typesize {0UL};


namespace eprosima {
namespace fastcdr {

class Cdr;
class CdrSizeCalculator;

eProsima_user_DllExport void serialize_key(
eprosima::fastcdr::Cdr& scdr,
const HelloWorld& data);


} // namespace fastcdr
} // namespace eprosima

#endif // _FAST_DDS_GENERATED_HELLOWORLDCDRAUX_HPP_
Loading