From 8d4533d883146bc7b4b3507484e6bbc344791cc7 Mon Sep 17 00:00:00 2001 From: JesusPoderoso Date: Mon, 26 Feb 2024 16:21:06 +0100 Subject: [PATCH] Refs #20495: Regenerate DS types: Fast DDS Gen v3.3.0 Signed-off-by: JesusPoderoso --- examples/HelloWorldExampleDS/HelloWorldv1.h | 7 +- resources/static_types/HelloWorld.cxx | 3 + resources/static_types/HelloWorld.h | 6 + resources/static_types/HelloWorldv1.cxx | 286 ++++++++++++++++++++ resources/static_types/HelloWorldv1.h | 244 +++++++++++++++++ 5 files changed, 543 insertions(+), 3 deletions(-) create mode 100644 resources/static_types/HelloWorldv1.cxx create mode 100644 resources/static_types/HelloWorldv1.h diff --git a/examples/HelloWorldExampleDS/HelloWorldv1.h b/examples/HelloWorldExampleDS/HelloWorldv1.h index 7758cd79..9f6f726e 100644 --- a/examples/HelloWorldExampleDS/HelloWorldv1.h +++ b/examples/HelloWorldExampleDS/HelloWorldv1.h @@ -29,12 +29,13 @@ #include -#include #include +#include +#include +#include +#include #include #include -#include -#include #if defined(_WIN32) #if defined(EPROSIMA_USER_DLL_EXPORT) diff --git a/resources/static_types/HelloWorld.cxx b/resources/static_types/HelloWorld.cxx index ef9331d5..4b415d67 100644 --- a/resources/static_types/HelloWorld.cxx +++ b/resources/static_types/HelloWorld.cxx @@ -28,6 +28,8 @@ char dummy; #include "HelloWorld.h" +#if FASTCDR_VERSION_MAJOR > 1 + #include @@ -163,3 +165,4 @@ std::string& HelloWorld::message() // Include auxiliary functions like for serializing/deserializing. #include "HelloWorldCdrAux.ipp" +#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/resources/static_types/HelloWorld.h b/resources/static_types/HelloWorld.h index b95bcb5b..5cd0ddba 100644 --- a/resources/static_types/HelloWorld.h +++ b/resources/static_types/HelloWorld.h @@ -19,6 +19,11 @@ * This file was generated by the tool fastddsgen. */ +#include +#include "HelloWorldv1.h" + +#if FASTCDR_VERSION_MAJOR > 1 + #ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ #define _FAST_DDS_GENERATED_HELLOWORLD_H_ @@ -187,3 +192,4 @@ class HelloWorld +#endif // FASTCDR_VERSION_MAJOR > 1 diff --git a/resources/static_types/HelloWorldv1.cxx b/resources/static_types/HelloWorldv1.cxx new file mode 100644 index 00000000..90e82ea8 --- /dev/null +++ b/resources/static_types/HelloWorldv1.cxx @@ -0,0 +1,286 @@ +// 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 HelloWorld.cpp + * This source file contains the implementation of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#ifdef _WIN32 +// Remove linker warning LNK4221 on Visual Studio +namespace { +char dummy; +} // namespace +#endif // _WIN32 + +#include "HelloWorld.h" + +#if FASTCDR_VERSION_MAJOR == 1 + +#include + + +#include +using namespace eprosima::fastcdr::exception; + +#include + +namespace helper { namespace internal { + +enum class Size { + UInt8, + UInt16, + UInt32, + UInt64, +}; + +constexpr Size get_size(int s) { + return (s <= 8 ) ? Size::UInt8: + (s <= 16) ? Size::UInt16: + (s <= 32) ? Size::UInt32: Size::UInt64; +} + +template +struct FindTypeH; + +template<> +struct FindTypeH { + using type = std::uint8_t; +}; + +template<> +struct FindTypeH { + using type = std::uint16_t; +}; + +template<> +struct FindTypeH { + using type = std::uint32_t; +}; + +template<> +struct FindTypeH { + using type = std::uint64_t; +}; +} + +template +struct FindType { + using type = typename internal::FindTypeH::type; +}; +} + +#define HelloWorld_max_cdr_typesize 268ULL; + + + + +HelloWorld::HelloWorld() +{ + // unsigned long m_index + m_index = 0; + // /type_d() m_message + + +} + +HelloWorld::~HelloWorld() +{ +} + +HelloWorld::HelloWorld( + const HelloWorld& x) +{ + m_index = x.m_index; + + + m_message = x.m_message; + +} + +HelloWorld::HelloWorld( + HelloWorld&& x) noexcept +{ + m_index = x.m_index; + + + m_message = std::move(x.m_message); + +} + +HelloWorld& HelloWorld::operator =( + const HelloWorld& x) +{ + m_index = x.m_index; + + + m_message = x.m_message; + + return *this; +} + +HelloWorld& HelloWorld::operator =( + HelloWorld&& x) noexcept +{ + m_index = x.m_index; + + + m_message = std::move(x.m_message); + + return *this; +} + +bool HelloWorld::operator ==( + const HelloWorld& x) const +{ + return (m_index == x.m_index && + m_message == x.m_message); +} + +bool HelloWorld::operator !=( + const HelloWorld& x) const +{ + return !(*this == x); +} + +size_t HelloWorld::getMaxCdrSerializedSize( + size_t current_alignment) +{ + static_cast(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; + + +} + + +bool HelloWorld::isKeyDefined() +{ + return false; +} + +void HelloWorld::serializeKey( + eprosima::fastcdr::Cdr& scdr) const +{ + (void) scdr; +} + +/*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ +void HelloWorld::index( + uint32_t _index) +{ + m_index = _index; +} + +/*! + * @brief This function returns the value of member index + * @return Value of member index + */ +uint32_t HelloWorld::index() const +{ + return m_index; +} + +/*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ +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 + */ +void HelloWorld::message( + const std::string& _message) +{ + m_message = _message; +} + +/*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ +void HelloWorld::message( + std::string&& _message) +{ + m_message = std::move(_message); +} + +/*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ +const std::string& HelloWorld::message() const +{ + return m_message; +} + +/*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ +std::string& HelloWorld::message() +{ + return m_message; +} + + + + +#endif // FASTCDR_VERSION_MAJOR == 1 diff --git a/resources/static_types/HelloWorldv1.h b/resources/static_types/HelloWorldv1.h new file mode 100644 index 00000000..9f6f726e --- /dev/null +++ b/resources/static_types/HelloWorldv1.h @@ -0,0 +1,244 @@ +// 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 HelloWorld.h + * This header file contains the declaration of the described types in the IDL file. + * + * This file was generated by the tool fastddsgen. + */ + +#include + +#if FASTCDR_VERSION_MAJOR == 1 + +#ifndef _FAST_DDS_GENERATED_HELLOWORLD_H_ +#define _FAST_DDS_GENERATED_HELLOWORLD_H_ + + +#include + +#include +#include +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#define eProsima_user_DllExport __declspec( dllexport ) +#else +#define eProsima_user_DllExport +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define eProsima_user_DllExport +#endif // _WIN32 + +#if defined(_WIN32) +#if defined(EPROSIMA_USER_DLL_EXPORT) +#if defined(HELLOWORLD_SOURCE) +#define HELLOWORLD_DllAPI __declspec( dllexport ) +#else +#define HELLOWORLD_DllAPI __declspec( dllimport ) +#endif // HELLOWORLD_SOURCE +#else +#define HELLOWORLD_DllAPI +#endif // EPROSIMA_USER_DLL_EXPORT +#else +#define HELLOWORLD_DllAPI +#endif // _WIN32 + +namespace eprosima { +namespace fastcdr { +class Cdr; +} // namespace fastcdr +} // namespace eprosima + + + + + +/*! + * @brief This class represents the structure HelloWorld defined by the user in the IDL file. + * @ingroup HelloWorld + */ +class HelloWorld +{ +public: + + /*! + * @brief Default constructor. + */ + eProsima_user_DllExport HelloWorld(); + + /*! + * @brief Default destructor. + */ + eProsima_user_DllExport ~HelloWorld(); + + /*! + * @brief Copy constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + const HelloWorld& x); + + /*! + * @brief Move constructor. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld( + HelloWorld&& x) noexcept; + + /*! + * @brief Copy assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + const HelloWorld& x); + + /*! + * @brief Move assignment. + * @param x Reference to the object HelloWorld that will be copied. + */ + eProsima_user_DllExport HelloWorld& operator =( + HelloWorld&& x) noexcept; + + /*! + * @brief Comparison operator. + * @param x HelloWorld object to compare. + */ + eProsima_user_DllExport bool operator ==( + const HelloWorld& x) const; + + /*! + * @brief Comparison operator. + * @param x HelloWorld object to compare. + */ + eProsima_user_DllExport bool operator !=( + const HelloWorld& x) const; + + /*! + * @brief This function sets a value in member index + * @param _index New value for member index + */ + eProsima_user_DllExport void index( + uint32_t _index); + + /*! + * @brief This function returns the value of member index + * @return Value of member index + */ + eProsima_user_DllExport uint32_t index() const; + + /*! + * @brief This function returns a reference to member index + * @return Reference to member index + */ + 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 + */ + eProsima_user_DllExport void message( + const std::string& _message); + + /*! + * @brief This function moves the value in member message + * @param _message New value to be moved in member message + */ + eProsima_user_DllExport void message( + std::string&& _message); + + /*! + * @brief This function returns a constant reference to member message + * @return Constant reference to member message + */ + eProsima_user_DllExport const std::string& message() const; + + /*! + * @brief This function returns a reference to member message + * @return Reference to member message + */ + 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 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; + std::string m_message; + +}; + + +#endif // _FAST_DDS_GENERATED_HELLOWORLD_H_ + + + +#endif // FASTCDR_VERSION_MAJOR == 1