Skip to content

Commit

Permalink
DynamicType to IDL serializer (#4787)
Browse files Browse the repository at this point in the history
* Add tree container

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* DynamicType to IDL serializer

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Make methods return RETCODES and noexcept

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Move TreeNodeType methods to a different file

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Check ReturnCodes from the DynamicTypes API

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Replace ostream with string

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Cover unbounded sequence scenario

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support TK_INT8 & TK_UINT8

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Include safety checks

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Add DOCSTRING descriptions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Dynamic Types to IDL

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests fixes - unbounded sequence & array length

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests fixes - TK_ENUM

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests fixes - TK_UNION

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Update versions.md

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Move dyn_type_tree to type_conversion

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Tree

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests fixes - Tree depth

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Rename Tree to TreeNode

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Refactor Dynamic Types to IDL

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support TK_BITSET

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - TK_BITSET

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support TK_BITMASK

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - TK_BITMASK

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support TK_ALIAS

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - TK_ALIAS

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support Annotation @key

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Annotation @key

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Rearrange & sort methods

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support Annotation @extensibility

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Annotation @extensibility

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Nested Struct

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Support inheritance in TK_STRUCT

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Tests - Inheritance in TK_STRUCT

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Rebase fix

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Restructure the code & regenerate types

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Apply suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Refactor Tests

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Primitives test

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Apply suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Apply suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Sort dependencies

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - Declaration of `bits` hides previous local declaration

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - Linking issues

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - Declaration of `info` hides member

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - to_upper

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Apply suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Apply JSON suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Uncrustify

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Review - Apply suggestions

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - default_type_kind may be used uninitialized

Signed-off-by: tempate <danieldiaz@eprosima.com>

* Fix - signed/unsigned mismatch

Signed-off-by: tempate <danieldiaz@eprosima.com>

---------

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
Signed-off-by: tempate <danieldiaz@eprosima.com>
Co-authored-by: tempate <danieldiaz@eprosima.com>
  • Loading branch information
juanlofer-eprosima and Tempate authored Jul 12, 2024
1 parent 77768eb commit bc67cf7
Show file tree
Hide file tree
Showing 122 changed files with 26,839 additions and 36 deletions.
13 changes: 13 additions & 0 deletions include/fastdds/dds/xtypes/utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@
#define FASTDDS_DDS_XTYPES__UTILS_HPP

#include <iostream>
#include <string>

#include <fastdds/dds/core/ReturnCode.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicData.hpp>
#include <fastdds/dds/xtypes/dynamic_types/DynamicType.hpp>
#include <fastdds/fastdds_dll.hpp>

namespace eprosima {
Expand All @@ -35,6 +37,17 @@ enum class DynamicDataJsonFormat
EPROSIMA,
};

/**
* @brief Serializes a @ref DynamicType into its IDL representation.
*
* @param [in] dynamic_type The @ref DynamicType to serialize.
* @param [in,out] output \c std::ostream reference containing the IDL representation.
* @retval RETCODE_OK when serialization fully succeeds, and inner (member serialization) failing code otherwise.
*/
FASTDDS_EXPORTED_API ReturnCode_t idl_serialize(
const DynamicType::_ref_type& dynamic_type,
std::ostream& output) noexcept;

/*!
* Serializes a @ref DynamicData into a JSON object, which is then dumped into an \c std::ostream.
* @param[in] data @ref DynamicData reference to be serialized.
Expand Down
1 change: 1 addition & 0 deletions src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ set(${PROJECT_NAME}_source_files
fastdds/xtypes/dynamic_types/TypeDescriptorImpl.cpp
fastdds/xtypes/dynamic_types/VerbatimTextDescriptorImpl.cpp
fastdds/xtypes/exception/Exception.cpp
fastdds/xtypes/serializers/idl/dynamic_type_idl.cpp
fastdds/xtypes/serializers/json/dynamic_data_json.cpp
fastdds/xtypes/type_representation/dds_xtypes_typeobjectPubSubTypes.cxx
fastdds/xtypes/type_representation/TypeObjectRegistry.cpp
Expand Down
2 changes: 2 additions & 0 deletions src/cpp/fastdds/xtypes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ target_sources(fastdds-xtypes-dynamic-types-impl INTERFACE
dynamic_types/TypeDescriptorImpl.hpp
dynamic_types/VerbatimTextDescriptorImpl.cpp
dynamic_types/VerbatimTextDescriptorImpl.hpp
serializers/idl/dynamic_type_idl.cpp
serializers/idl/dynamic_type_idl.hpp
serializers/json/dynamic_data_json.cpp
serializers/json/dynamic_data_json.hpp
utils.cpp
Expand Down
Loading

0 comments on commit bc67cf7

Please sign in to comment.