diff --git a/fastdds_python/test/types/test_complete.hpp b/fastdds_python/test/types/test_complete.hpp index cc4cdf88..e9c339aa 100644 --- a/fastdds_python/test/types/test_complete.hpp +++ b/fastdds_python/test/types/test_complete.hpp @@ -16,11 +16,11 @@ * @file test_complete.hpp * This header file contains the declaration of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_HPP -#define FAST_DDS_GENERATED__TEST_COMPLETE_HPP +#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_HPP +#define FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_HPP #include #include @@ -7602,6 +7602,6 @@ class KeyedCompleteTestType }; -#endif // _FAST_DDS_GENERATED_TEST_COMPLETE_HPP_ +#endif // _FAST_DDS_GENERATED_TEST_COMPLETE_IDL_EPROSIMA_TEST2_HPP_ diff --git a/fastdds_python/test/types/test_complete.i b/fastdds_python/test/types/test_complete.i index 4b7be43e..ba7955c8 100644 --- a/fastdds_python/test/types/test_complete.i +++ b/fastdds_python/test/types/test_complete.i @@ -16,7 +16,7 @@ * @file test_complete.i * This header file contains the SWIG interface of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %module(moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('test_complete.dll')\nif __package__ or '.' in __name__:\n from . import _test_completeWrapper\nelse:\n import _test_completeWrapper") test_complete diff --git a/fastdds_python/test/types/test_completeCdrAux.hpp b/fastdds_python/test/types/test_completeCdrAux.hpp index 7360b030..d9bdadde 100644 --- a/fastdds_python/test/types/test_completeCdrAux.hpp +++ b/fastdds_python/test/types/test_completeCdrAux.hpp @@ -16,11 +16,11 @@ * @file test_completeCdrAux.hpp * This source file contains some definitions of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_HPP -#define FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_HPP +#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_HPP +#define FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_HPP #include "test_complete.hpp" @@ -61,5 +61,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_HPP +#endif // FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_HPP diff --git a/fastdds_python/test/types/test_completeCdrAux.ipp b/fastdds_python/test/types/test_completeCdrAux.ipp index 0ec4410a..98a5e7a0 100644 --- a/fastdds_python/test/types/test_completeCdrAux.ipp +++ b/fastdds_python/test/types/test_completeCdrAux.ipp @@ -16,11 +16,11 @@ * @file test_completeCdrAux.ipp * This source file contains some declarations of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_IPP -#define FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_IPP +#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_IPP +#define FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_IPP #include "test_completeCdrAux.hpp" @@ -141,6 +141,38 @@ eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, StructType& data) { + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(Color::RED); + + data.enum2_field(Material::WOOD); + + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -602,6 +634,123 @@ eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, CompleteTestType& data) { + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(Color::RED); + + data.enum2_field(Material::WOOD); + + + data.char_opt_field().reset(); + + data.uint8_opt_field().reset(); + + data.int16_opt_field().reset(); + + data.uint16_opt_field().reset(); + + data.int32_opt_field().reset(); + + data.uint32_opt_field().reset(); + + data.int64_opt_field().reset(); + + data.uint64_opt_field().reset(); + + data.float_opt_field().reset(); + + data.double_opt_field().reset(); + + data.bool_opt_field().reset(); + + data.string_opt_field().reset(); + + data.enum_opt_field().reset(); + + data.enum2_opt_field().reset(); + + data.struct_opt_field().reset(); + + data.array_char_field({0}); + + data.array_uint8_field({0}); + + data.array_int16_field({0}); + + data.array_uint16_field({0}); + + data.array_int32_field({0}); + + data.array_uint32_field({0}); + + data.array_int64_field({0}); + + data.array_uint64_field({0}); + + data.array_float_field({0.0}); + + data.array_double_field({0.0}); + + data.array_bool_field({false}); + + data.array_enum_field({Color::RED}); + + data.array_enum2_field({Material::WOOD}); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -1514,6 +1663,125 @@ eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, KeyedCompleteTestType& data) { + data.id(0); + + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(Color::RED); + + data.enum2_field(Material::WOOD); + + + data.char_opt_field().reset(); + + data.uint8_opt_field().reset(); + + data.int16_opt_field().reset(); + + data.uint16_opt_field().reset(); + + data.int32_opt_field().reset(); + + data.uint32_opt_field().reset(); + + data.int64_opt_field().reset(); + + data.uint64_opt_field().reset(); + + data.float_opt_field().reset(); + + data.double_opt_field().reset(); + + data.bool_opt_field().reset(); + + data.string_opt_field().reset(); + + data.enum_opt_field().reset(); + + data.enum2_opt_field().reset(); + + data.struct_opt_field().reset(); + + data.array_char_field({0}); + + data.array_uint8_field({0}); + + data.array_int16_field({0}); + + data.array_uint16_field({0}); + + data.array_int32_field({0}); + + data.array_uint32_field({0}); + + data.array_int64_field({0}); + + data.array_uint64_field({0}); + + data.array_float_field({0.0}); + + data.array_double_field({0.0}); + + data.array_bool_field({false}); + + data.array_enum_field({Color::RED}); + + data.array_enum2_field({Material::WOOD}); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -1979,5 +2247,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__TEST_COMPLETECDRAUX_IPP +#endif // FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2CDRAUX_IPP diff --git a/fastdds_python/test/types/test_completePubSubTypes.cxx b/fastdds_python/test/types/test_completePubSubTypes.cxx index 94fdc4be..b6fb1476 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.cxx +++ b/fastdds_python/test/types/test_completePubSubTypes.cxx @@ -16,7 +16,7 @@ * @file test_completePubSubTypes.cpp * This header file contains the implementation of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_completePubSubTypes.hpp" diff --git a/fastdds_python/test/types/test_completePubSubTypes.hpp b/fastdds_python/test/types/test_completePubSubTypes.hpp index 5bc713a4..6fd12c3f 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.hpp +++ b/fastdds_python/test/types/test_completePubSubTypes.hpp @@ -16,12 +16,12 @@ * @file test_completePubSubTypes.hpp * This header file contains the declaration of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__TEST_COMPLETE_PUBSUBTYPES_HPP +#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP #include @@ -280,5 +280,5 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData }; -#endif // FAST_DDS_GENERATED__TEST_COMPLETE_PUBSUBTYPES_HPP +#endif // FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP diff --git a/fastdds_python/test/types/test_completePubSubTypes.i b/fastdds_python/test/types/test_completePubSubTypes.i index c959f459..2a990d47 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.i +++ b/fastdds_python/test/types/test_completePubSubTypes.i @@ -16,7 +16,7 @@ * @file test_completePubSubTypes.i * This header file contains the SWIG interface of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; diff --git a/fastdds_python/test/types/test_completeTypeObjectSupport.cxx b/fastdds_python/test/types/test_completeTypeObjectSupport.cxx index 046fa0df..63524b7d 100644 --- a/fastdds_python/test/types/test_completeTypeObjectSupport.cxx +++ b/fastdds_python/test/types/test_completeTypeObjectSupport.cxx @@ -16,7 +16,7 @@ * @file test_completeTypeObjectSupport.cxx * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_completeTypeObjectSupport.hpp" diff --git a/fastdds_python/test/types/test_completeTypeObjectSupport.hpp b/fastdds_python/test/types/test_completeTypeObjectSupport.hpp index 9e4ac085..e6cabf04 100644 --- a/fastdds_python/test/types/test_completeTypeObjectSupport.hpp +++ b/fastdds_python/test/types/test_completeTypeObjectSupport.hpp @@ -16,11 +16,11 @@ * @file test_completeTypeObjectSupport.hpp * Header file containing the API required to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__TEST_COMPLETE_TYPE_OBJECT_SUPPORT_HPP +#ifndef FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP #include @@ -102,4 +102,4 @@ eProsima_user_DllExport void register_KeyedCompleteTestType_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FAST_DDS_GENERATED__TEST_COMPLETE_TYPE_OBJECT_SUPPORT_HPP +#endif // FAST_DDS_GENERATED__TEST_COMPLETE_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python/test/types/test_included_modules.hpp b/fastdds_python/test/types/test_included_modules.hpp index addb409c..c162cd91 100644 --- a/fastdds_python/test/types/test_included_modules.hpp +++ b/fastdds_python/test/types/test_included_modules.hpp @@ -16,11 +16,11 @@ * @file test_included_modules.hpp * This header file contains the declaration of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_HPP +#ifndef FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_HPP +#define FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_HPP #include #include @@ -698,6 +698,6 @@ class StructType2 } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_TEST2_TEST_INCLUDED_MODULES_HPP_ +#endif // _FAST_DDS_GENERATED_TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_HPP_ diff --git a/fastdds_python/test/types/test_included_modules.i b/fastdds_python/test/types/test_included_modules.i index 6a015410..5f6bd39b 100644 --- a/fastdds_python/test/types/test_included_modules.i +++ b/fastdds_python/test/types/test_included_modules.i @@ -16,7 +16,7 @@ * @file test_included_modules.i * This header file contains the SWIG interface of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %module(moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('test_included_modules.dll')\nif __package__ or '.' in __name__:\n from . import _test_included_modulesWrapper\nelse:\n import _test_included_modulesWrapper") test_included_modules diff --git a/fastdds_python/test/types/test_included_modulesCdrAux.hpp b/fastdds_python/test/types/test_included_modulesCdrAux.hpp index 3256f8a6..a752c6af 100644 --- a/fastdds_python/test/types/test_included_modulesCdrAux.hpp +++ b/fastdds_python/test/types/test_included_modulesCdrAux.hpp @@ -16,11 +16,11 @@ * @file test_included_modulesCdrAux.hpp * This source file contains some definitions of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_HPP +#ifndef FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_HPP +#define FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_HPP #include "test_included_modules.hpp" @@ -43,5 +43,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_HPP +#endif // FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_HPP diff --git a/fastdds_python/test/types/test_included_modulesCdrAux.ipp b/fastdds_python/test/types/test_included_modulesCdrAux.ipp index 523b0182..01a8b038 100644 --- a/fastdds_python/test/types/test_included_modulesCdrAux.ipp +++ b/fastdds_python/test/types/test_included_modulesCdrAux.ipp @@ -16,11 +16,11 @@ * @file test_included_modulesCdrAux.ipp * This source file contains some declarations of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_IPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_IPP +#ifndef FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_IPP +#define FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_IPP #include "test_included_modulesCdrAux.hpp" @@ -139,6 +139,35 @@ eProsima_user_DllExport void deserialize( { using namespace eprosima::test2; + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.enum_field(eprosima::test2::Color2::RED2); + + data.enum2_field(eprosima::test2::Material2::WOOD2); + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -254,5 +283,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULESCDRAUX_IPP +#endif // FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2CDRAUX_IPP diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx index febf4eab..cccbed86 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx @@ -16,7 +16,7 @@ * @file test_included_modulesPubSubTypes.cpp * This header file contains the implementation of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_included_modulesPubSubTypes.hpp" diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.hpp b/fastdds_python/test/types/test_included_modulesPubSubTypes.hpp index 764bf56f..80a3cf87 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.hpp +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.hpp @@ -16,12 +16,12 @@ * @file test_included_modulesPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_PUBSUBTYPES_HPP +#ifndef FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP #include @@ -122,5 +122,5 @@ class StructType2PubSubType : public eprosima::fastdds::dds::TopicDataType } // namespace test2 } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_PUBSUBTYPES_HPP +#endif // FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_PUBSUBTYPES_HPP diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.i b/fastdds_python/test/types/test_included_modulesPubSubTypes.i index 91579826..0a6299ac 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.i +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.i @@ -16,7 +16,7 @@ * @file test_included_modulesPubSubTypes.i * This header file contains the SWIG interface of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; diff --git a/fastdds_python/test/types/test_included_modulesTypeObjectSupport.cxx b/fastdds_python/test/types/test_included_modulesTypeObjectSupport.cxx index 8369ab2a..73e6c948 100644 --- a/fastdds_python/test/types/test_included_modulesTypeObjectSupport.cxx +++ b/fastdds_python/test/types/test_included_modulesTypeObjectSupport.cxx @@ -16,7 +16,7 @@ * @file test_included_modulesTypeObjectSupport.cxx * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_included_modulesTypeObjectSupport.hpp" diff --git a/fastdds_python/test/types/test_included_modulesTypeObjectSupport.hpp b/fastdds_python/test/types/test_included_modulesTypeObjectSupport.hpp index f0dd0e1a..7c4b8c85 100644 --- a/fastdds_python/test/types/test_included_modulesTypeObjectSupport.hpp +++ b/fastdds_python/test/types/test_included_modulesTypeObjectSupport.hpp @@ -16,11 +16,11 @@ * @file test_included_modulesTypeObjectSupport.hpp * Header file containing the API required to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_TYPE_OBJECT_SUPPORT_HPP +#ifndef FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP #include @@ -85,4 +85,4 @@ eProsima_user_DllExport void register_StructType2_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST2_TEST_INCLUDED_MODULES_TYPE_OBJECT_SUPPORT_HPP +#endif // FAST_DDS_GENERATED__TEST_INCLUDED_MODULES_IDL_EPROSIMA_TEST2_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python/test/types/test_modules.hpp b/fastdds_python/test/types/test_modules.hpp index 9d056fc3..0267ace0 100644 --- a/fastdds_python/test/types/test_modules.hpp +++ b/fastdds_python/test/types/test_modules.hpp @@ -16,11 +16,11 @@ * @file test_modules.hpp * This header file contains the declaration of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_HPP +#ifndef FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_HPP +#define FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_HPP #include #include @@ -7562,6 +7562,6 @@ class KeyedCompleteTestType } // namespace eprosima -#endif // _FAST_DDS_GENERATED_EPROSIMA_TEST_TEST_MODULES_HPP_ +#endif // _FAST_DDS_GENERATED_TEST_MODULES_IDL_EPROSIMA_TEST_HPP_ diff --git a/fastdds_python/test/types/test_modules.i b/fastdds_python/test/types/test_modules.i index 2d45c4f0..0aae4d76 100644 --- a/fastdds_python/test/types/test_modules.i +++ b/fastdds_python/test/types/test_modules.i @@ -16,7 +16,7 @@ * @file test_modules.i * This header file contains the SWIG interface of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %module(moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('test_modules.dll')\nif __package__ or '.' in __name__:\n from . import _test_modulesWrapper\nelse:\n import _test_modulesWrapper") test_modules diff --git a/fastdds_python/test/types/test_modulesCdrAux.hpp b/fastdds_python/test/types/test_modulesCdrAux.hpp index baced0e6..ab1ce769 100644 --- a/fastdds_python/test/types/test_modulesCdrAux.hpp +++ b/fastdds_python/test/types/test_modulesCdrAux.hpp @@ -16,11 +16,11 @@ * @file test_modulesCdrAux.hpp * This source file contains some definitions of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_HPP +#ifndef FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_HPP +#define FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_HPP #include "test_modules.hpp" @@ -57,5 +57,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_HPP +#endif // FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_HPP diff --git a/fastdds_python/test/types/test_modulesCdrAux.ipp b/fastdds_python/test/types/test_modulesCdrAux.ipp index 8fef007b..7b223dde 100644 --- a/fastdds_python/test/types/test_modulesCdrAux.ipp +++ b/fastdds_python/test/types/test_modulesCdrAux.ipp @@ -16,11 +16,11 @@ * @file test_modulesCdrAux.ipp * This source file contains some declarations of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_IPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_IPP +#ifndef FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_IPP +#define FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_IPP #include "test_modulesCdrAux.hpp" @@ -143,6 +143,37 @@ eProsima_user_DllExport void deserialize( { using namespace eprosima::test; + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(eprosima::test::Color::RED); + + data.enum2_field(eprosima::test::Material::WOOD); + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -600,6 +631,123 @@ eProsima_user_DllExport void deserialize( eprosima::test::CompleteTestType& data) { using namespace eprosima::test; + + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(eprosima::test::Color::RED); + + data.enum2_field(eprosima::test::Material::WOOD); + + + data.char_opt_field().reset(); + + data.uint8_opt_field().reset(); + + data.int16_opt_field().reset(); + + data.uint16_opt_field().reset(); + + data.int32_opt_field().reset(); + + data.uint32_opt_field().reset(); + + data.int64_opt_field().reset(); + + data.uint64_opt_field().reset(); + + data.float_opt_field().reset(); + + data.double_opt_field().reset(); + + data.bool_opt_field().reset(); + + data.string_opt_field().reset(); + + data.enum_opt_field().reset(); + + data.enum2_opt_field().reset(); + + data.struct_opt_field().reset(); + + data.array_char_field({0}); + + data.array_uint8_field({0}); + + data.array_int16_field({0}); + + data.array_uint16_field({0}); + + data.array_int32_field({0}); + + data.array_uint32_field({0}); + + data.array_int64_field({0}); + + data.array_uint64_field({0}); + + data.array_float_field({0.0}); + + data.array_double_field({0.0}); + + data.array_bool_field({false}); + + data.array_enum_field({eprosima::test::Color::RED}); + + data.array_enum2_field({eprosima::test::Material::WOOD}); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : @@ -1519,6 +1667,125 @@ eProsima_user_DllExport void deserialize( eprosima::test::KeyedCompleteTestType& data) { using namespace eprosima::test; + + data.id(0); + + data.char_field(0); + + data.uint8_field(0); + + data.int16_field(0); + + data.uint16_field(0); + + data.int32_field(0); + + data.uint32_field(0); + + data.int64_field(0); + + data.uint64_field(0); + + data.float_field(0.0); + + data.double_field(0.0); + + data.bool_field(false); + + data.string_field({}); + + data.fixed_string_field({}); + + data.enum_field(eprosima::test::Color::RED); + + data.enum2_field(eprosima::test::Material::WOOD); + + + data.char_opt_field().reset(); + + data.uint8_opt_field().reset(); + + data.int16_opt_field().reset(); + + data.uint16_opt_field().reset(); + + data.int32_opt_field().reset(); + + data.uint32_opt_field().reset(); + + data.int64_opt_field().reset(); + + data.uint64_opt_field().reset(); + + data.float_opt_field().reset(); + + data.double_opt_field().reset(); + + data.bool_opt_field().reset(); + + data.string_opt_field().reset(); + + data.enum_opt_field().reset(); + + data.enum2_opt_field().reset(); + + data.struct_opt_field().reset(); + + data.array_char_field({0}); + + data.array_uint8_field({0}); + + data.array_int16_field({0}); + + data.array_uint16_field({0}); + + data.array_int32_field({0}); + + data.array_uint32_field({0}); + + data.array_int64_field({0}); + + data.array_uint64_field({0}); + + data.array_float_field({0.0}); + + data.array_double_field({0.0}); + + data.array_bool_field({false}); + + data.array_enum_field({eprosima::test::Color::RED}); + + data.array_enum2_field({eprosima::test::Material::WOOD}); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : @@ -1986,5 +2253,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULESCDRAUX_IPP +#endif // FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TESTCDRAUX_IPP diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_modulesPubSubTypes.cxx index ce1fc3de..ea954f02 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_modulesPubSubTypes.cxx @@ -16,7 +16,7 @@ * @file test_modulesPubSubTypes.cpp * This header file contains the implementation of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_modulesPubSubTypes.hpp" diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.hpp b/fastdds_python/test/types/test_modulesPubSubTypes.hpp index 851a6afd..6944b2ef 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.hpp +++ b/fastdds_python/test/types/test_modulesPubSubTypes.hpp @@ -16,12 +16,12 @@ * @file test_modulesPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_PUBSUBTYPES_HPP +#ifndef FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_PUBSUBTYPES_HPP #include @@ -283,5 +283,5 @@ class KeyedCompleteTestTypePubSubType : public eprosima::fastdds::dds::TopicData } // namespace test } // namespace eprosima -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_PUBSUBTYPES_HPP +#endif // FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_PUBSUBTYPES_HPP diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.i b/fastdds_python/test/types/test_modulesPubSubTypes.i index 51a23015..4ba9e08f 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.i +++ b/fastdds_python/test/types/test_modulesPubSubTypes.i @@ -16,7 +16,7 @@ * @file test_modulesPubSubTypes.i * This header file contains the SWIG interface of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; diff --git a/fastdds_python/test/types/test_modulesTypeObjectSupport.cxx b/fastdds_python/test/types/test_modulesTypeObjectSupport.cxx index aee9c8d0..5b80f31a 100644 --- a/fastdds_python/test/types/test_modulesTypeObjectSupport.cxx +++ b/fastdds_python/test/types/test_modulesTypeObjectSupport.cxx @@ -16,7 +16,7 @@ * @file test_modulesTypeObjectSupport.cxx * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "test_modulesTypeObjectSupport.hpp" diff --git a/fastdds_python/test/types/test_modulesTypeObjectSupport.hpp b/fastdds_python/test/types/test_modulesTypeObjectSupport.hpp index 661fd88a..c520d6dc 100644 --- a/fastdds_python/test/types/test_modulesTypeObjectSupport.hpp +++ b/fastdds_python/test/types/test_modulesTypeObjectSupport.hpp @@ -16,11 +16,11 @@ * @file test_modulesTypeObjectSupport.hpp * Header file containing the API required to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_TYPE_OBJECT_SUPPORT_HPP +#ifndef FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_TYPE_OBJECT_SUPPORT_HPP #include @@ -111,4 +111,4 @@ eProsima_user_DllExport void register_KeyedCompleteTestType_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FAST_DDS_GENERATED__EPROSIMA_TEST_TEST_MODULES_TYPE_OBJECT_SUPPORT_HPP +#endif // FAST_DDS_GENERATED__TEST_MODULES_IDL_EPROSIMA_TEST_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python_examples/CMakeLists.txt b/fastdds_python_examples/CMakeLists.txt index b48e088d..f48d5657 100644 --- a/fastdds_python_examples/CMakeLists.txt +++ b/fastdds_python_examples/CMakeLists.txt @@ -21,4 +21,3 @@ project(FastDdsPythonExamples) ############################################################################### add_subdirectory(HelloWorldExample/generated_code) -add_subdirectory(RPCExample/generated_code) diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.hpp b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.hpp index b80e4e9a..a539d686 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.hpp +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.hpp @@ -16,11 +16,11 @@ * @file HelloWorld.hpp * This header file contains the declaration of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__HELLOWORLD_HPP -#define FAST_DDS_GENERATED__HELLOWORLD_HPP +#ifndef FAST_DDS_GENERATED__HELLOWORLD_IDL_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_IDL_HPP #include #include @@ -222,6 +222,6 @@ class HelloWorld }; -#endif // _FAST_DDS_GENERATED_HELLOWORLD_HPP_ +#endif // _FAST_DDS_GENERATED_HELLOWORLD_IDL_HPP_ diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.i b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.i index c33566c7..8fb4b435 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.i +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorld.i @@ -16,7 +16,7 @@ * @file HelloWorld.i * This header file contains the SWIG interface of the described types in the IDL file. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %module(moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('HelloWorld.dll')\nif __package__ or '.' in __name__:\n from . import _HelloWorldWrapper\nelse:\n import _HelloWorldWrapper") HelloWorld diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.hpp b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.hpp index de6f08c5..0f9b1676 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.hpp +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.hpp @@ -16,11 +16,11 @@ * @file HelloWorldCdrAux.hpp * This source file contains some definitions of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP -#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP +#ifndef FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_HPP #include "HelloWorld.hpp" @@ -42,5 +42,5 @@ eProsima_user_DllExport void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_HPP +#endif // FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_HPP diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.ipp b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.ipp index 2c11e256..bec63883 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.ipp +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldCdrAux.ipp @@ -16,11 +16,11 @@ * @file HelloWorldCdrAux.ipp * This source file contains some declarations of CDR related functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP -#define FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP +#ifndef FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_IPP +#define FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_IPP #include "HelloWorldCdrAux.hpp" @@ -85,6 +85,11 @@ eProsima_user_DllExport void deserialize( eprosima::fastcdr::Cdr& cdr, HelloWorld& data) { + data.index(0); + + data.message({}); + + cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? eprosima::fastcdr::EncodingAlgorithmFlag::DELIMIT_CDR2 : eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, @@ -127,5 +132,5 @@ void serialize_key( } // namespace fastcdr } // namespace eprosima -#endif // FAST_DDS_GENERATED__HELLOWORLDCDRAUX_IPP +#endif // FAST_DDS_GENERATED__HELLOWORLD_IDLCDRAUX_IPP diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.cxx b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.cxx index 403ea1b4..53488203 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.cxx +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.cxx @@ -16,7 +16,7 @@ * @file HelloWorldPubSubTypes.cpp * This header file contains the implementation of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "HelloWorldPubSubTypes.hpp" diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.hpp b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.hpp index 9b807445..c4e55681 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.hpp +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.hpp @@ -16,12 +16,12 @@ * @file HelloWorldPubSubTypes.hpp * This header file contains the declaration of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP +#ifndef FAST_DDS_GENERATED__HELLOWORLD_IDL_PUBSUBTYPES_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_IDL_PUBSUBTYPES_HPP #include @@ -118,5 +118,5 @@ class HelloWorldPubSubType : public eprosima::fastdds::dds::TopicDataType }; -#endif // FAST_DDS_GENERATED__HELLOWORLD_PUBSUBTYPES_HPP +#endif // FAST_DDS_GENERATED__HELLOWORLD_IDL_PUBSUBTYPES_HPP diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.i b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.i index 44af5dd0..0e9e0466 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.i +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldPubSubTypes.i @@ -16,7 +16,7 @@ * @file HelloWorldPubSubTypes.i * This header file contains the SWIG interface of the serialization functions. * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ %import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.cxx b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.cxx index fffd4a87..e6a2a336 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.cxx +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.cxx @@ -16,7 +16,7 @@ * @file HelloWorldTypeObjectSupport.cxx * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ #include "HelloWorldTypeObjectSupport.hpp" diff --git a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.hpp b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.hpp index 9892c714..8fe0e1f4 100644 --- a/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.hpp +++ b/fastdds_python_examples/HelloWorldExample/generated_code/HelloWorldTypeObjectSupport.hpp @@ -16,11 +16,11 @@ * @file HelloWorldTypeObjectSupport.hpp * Header file containing the API required to register the TypeObject representation of the described types in the IDL file * - * This file was generated by the tool fastddsgen (version: 4.0.6). + * This file was generated by the tool fastddsgen (version: 4.0.7). */ -#ifndef FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP +#ifndef FAST_DDS_GENERATED__HELLOWORLD_IDL_TYPE_OBJECT_SUPPORT_HPP +#define FAST_DDS_GENERATED__HELLOWORLD_IDL_TYPE_OBJECT_SUPPORT_HPP #include @@ -53,4 +53,4 @@ eProsima_user_DllExport void register_HelloWorld_type_identifier( #endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC -#endif // FAST_DDS_GENERATED__HELLOWORLD_TYPE_OBJECT_SUPPORT_HPP +#endif // FAST_DDS_GENERATED__HELLOWORLD_IDL_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python_examples/RPCExample/CalculatorExample.py b/fastdds_python_examples/RPCExample/CalculatorExample.py deleted file mode 100644 index 5996cb48..00000000 --- a/fastdds_python_examples/RPCExample/CalculatorExample.py +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/env python3 -# # Copyright 2025 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. -""" -Script to test Fast DDS python bindings for RPC -""" -import os -import argparse -import threading -import time - -import fastdds -import calculator - -DESCRIPTION = """Calculator RPC example for Fast DDS python bindings""" -USAGE = ('python3 CalculatorExample.py -p client|server [-d domainID -t server_threads]') - -### Server implementation ### - -class MyCalculatorImplementation(calculator.CalculatorServerImplementation): - def __init__(self): - super().__init__() - - def operation_call_print(self, info, operation_name): - print("Operation {op} called from client with id {id}".format(op=operation_name, id=info.get_client_id())) - - def addition(self, info, value1, value2): - self.operation_call_print(info, "addition") - return value1 + value2 - - def subtraction(self, info, value1, value2): - self.operation_call_print(info, "subtraction") - return value1 - value2 - - def representation_limits(self, info): - self.operation_call_print(info, "representation_limits") - ret_val = calculator.BasicCalculator_representation_limits_Out() - ret_val.min_value = -2147483648 - ret_val.max_value = 2147483647 - return ret_val - -### Server application ### - -def run_server(server): - server.run() - -class Server: - def __init__(self, domain, num_threads): - # Create participant - factory = fastdds.DomainParticipantFactory.get_instance() - self.participant_qos = fastdds.DomainParticipantQos() - factory.get_default_participant_qos(self.participant_qos) - self.participant = factory.create_participant(domain, self.participant_qos) - - # Create server - self.implementation = MyCalculatorImplementation() - self.server_qos = fastdds.ReplierQos() - self.server = calculator.create_CalculatorServer( - self.participant, "my_calculator", self.server_qos, num_threads, self.implementation) - - def run(self): - thr = threading.Thread(target=run_server, args=(self.server,)) - thr.start() - print("Server is running. Press any key to stop it.") - try: - input() - except: - pass - self.server.stop() - thr.join() - -### Client application ### - -class Client: - def __init__(self, domain): - # Create participant - factory = fastdds.DomainParticipantFactory.get_instance() - self.participant_qos = fastdds.DomainParticipantQos() - factory.get_default_participant_qos(self.participant_qos) - self.participant = factory.create_participant(domain, self.participant_qos) - - # Create client - self.client_qos = fastdds.RequesterQos() - self.client = calculator.create_CalculatorClient( - self.participant, "my_calculator", self.client_qos) - - def run(self): - # TODO: wait for server to be ready - time.sleep(2) - - self.perform_addition() - self.perform_subtraction() - self.perform_representation_limits() - - def perform_addition(self): - try: - # Perform basic addition - print("Performing addition(1, 2)") - result = self.client.addition(1, 2) - print("Result: {}".format(result.get())) - - # Perform addition with overflow - print("Performing addition(2147483647, 1)") - result = self.client.addition(2147483647, 1) - print("Result: {}".format(result=result.get())) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - - def perform_subtraction(self): - try: - # Perform basic subtraction - print("Performing subtraction(2, 1)") - result = self.client.subtraction(2, 1) - print("Result: {}".format(result.get())) - - # Perform subtraction with underflow - print("Performing subtraction(-2147483648, 1)") - result = self.client.subtraction(-2147483648, 1) - result.wait() - print("Result: {}".format(result=result.get())) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - - def perform_representation_limits(self): - try: - # Perform representation limits - print("Performing representation_limits()") - result = self.client.representation_limits() - data = result.get() - print("Result: {min}, {max}".format(min=data.min_value, max=data.max_value)) - except Exception as e: - print("Exception: {}".format(type(e).__name__)) - print("Exception message: {}".format(e)) - -def parse_options(): - """" - Parse arguments. - - :return: Parsed arguments. - """ - parser = argparse.ArgumentParser( - formatter_class=argparse.ArgumentDefaultsHelpFormatter, - add_help=True, - description=(DESCRIPTION), - usage=(USAGE) - ) - required_args = parser.add_argument_group('required arguments') - required_args.add_argument( - '-d', - '--domain', - type=int, - required=False, - help='DomainID.' - ) - required_args.add_argument( - '-p', - '--parameter', - type=str, - required=True, - help='Whether the application is run as client or server.' - ) - required_args.add_argument( - '-t', - '--server_threads', - type=int, - required=False, - help='Number of threads in the server pool. Only applies if the application is run as server.' - ) - return parser.parse_args() - -if __name__ == '__main__': - # Parse arguments - args = parse_options() - if not args.domain: - args.domain = 0 - if not args.server_threads: - args.server_threads = 1 - - if args.parameter == 'client': - print('Creating client.') - client = Client(args.domain) - client.run() - elif args.parameter == 'server': - print('Creating server.') - server = Server(args.domain, args.server_threads) - server.run() - else: - print('Error: Incorrect arguments.') - print(USAGE) - - exit() diff --git a/fastdds_python_examples/RPCExample/README.md b/fastdds_python_examples/RPCExample/README.md deleted file mode 100644 index bf57c1dc..00000000 --- a/fastdds_python_examples/RPCExample/README.md +++ /dev/null @@ -1,28 +0,0 @@ -# Python binding CalculatorExample - -This example implements a basic client/server RPC application. -In order to launch the example it is required to indicate if the application is run as client or server. -Therefore, open two terminals and move to the folder where the Python script is located. -On the first terminal run the server executing the following command: - -```bash -python3 CalculatorExample.py -p server -``` - -On the second terminal run the client as follows: - -```bash -python3 CalculatorExample.py -p client -``` - -The client application waits for two seconds for the server to be discovered, and then performs several RPC calls. -For each call, the operation result is shown. -On the server application, the GUID of the client and the requested operation is shown for each processed request. - -## Parameters - -This example allows the following parameters: - -* `--parameter`/`-p`: whether the application is run as client or server. This parameter is required. -* `--domain`/`-d`: domain ID where the application is run. This parameter is optional. In case that it is not provided by the user, domain ID will be 0. -* `--server_threads`/`-t`: the number of threads for processing requests (defaults to 1). This parameter only applies if the application is run as server. diff --git a/fastdds_python_examples/RPCExample/calculator.idl b/fastdds_python_examples/RPCExample/calculator.idl deleted file mode 100644 index ea61423c..00000000 --- a/fastdds_python_examples/RPCExample/calculator.idl +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2025 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. - -module calculator_base -{ - // This exception will be thrown when an operation result cannot be represented in a long - exception OverflowException - { - }; - - @nested - interface Adder - { - // Returns the result of value1 + value2 - long addition(in long value1, in long value2) raises(OverflowException); - }; - - @nested - interface Subtractor - { - // Returns the result of value1 - value2 - long subtraction(in long value1, in long value2) raises(OverflowException); - }; -}; - -interface Calculator : calculator_base::Adder, calculator_base::Subtractor -{ - // Returns the minimum and maximum representable values - void representation_limits(out long min_value, out long max_value); -}; diff --git a/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt b/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt deleted file mode 100644 index e33dd72c..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/CMakeLists.txt +++ /dev/null @@ -1,124 +0,0 @@ - -cmake_minimum_required(VERSION 3.20) - -# SWIG: use standard target name. -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif() - -# SWIG: use SWIG_MODULE_NAME property. -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif() - -############################################################################### -# Library for types defined in calculator IDL -############################################################################### - -message(STATUS "Configuring python wrapper for types in calculator...") - -############################################################################### -# Type library on C++ - -project(calculator) - -find_package(fastcdr REQUIRED) -find_package(fastdds 3 REQUIRED) - -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -if(NOT WIN32) - # Default values for shared library suffix in MacOS - if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") - set(CMAKE_SHARED_LIBRARY_SUFFIX ".so") - endif() -endif() - -#Create library for C++ types -add_library(${PROJECT_NAME} SHARED - calculatorTypeObjectSupport.cxx - ) -if(WIN32) - target_compile_definitions(${PROJECT_NAME} PRIVATE EPROSIMA_USER_DLL_EXPORT) -endif(WIN32) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_include_directories(${PROJECT_NAME} PUBLIC - ${PROJECT_SOURCE_DIR} - ) -target_link_libraries(${PROJECT_NAME} - PUBLIC - fastcdr - fastdds - ) - -############################################################################### -# Python bindings for type - -find_package(SWIG) -if (NOT SWIG_FOUND) - # Trick to find swig4.1 in Ubuntu noble. - find_program(SWIG_EXECUTABLE NAMES swig4.1 swig) - find_package(SWIG REQUIRED) -endif() -include(${SWIG_USE_FILE}) -set(CMAKE_SWIG_FLAGS "") - -find_package(Python3 COMPONENTS Interpreter Development REQUIRED) -set(PYTHON_INCLUDE_PATH ${Python3_INCLUDE_DIRS}) -set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) -set(PYTHON_LIBRARIES ${Python3_LIBRARIES}) - -include_directories(${PYTHON_INCLUDE_PATH}) - -set(${PROJECT_NAME}_MODULE - calculatorWrapper - ) - -set(${PROJECT_NAME}_MODULE_FILES - calculator.i - ) - -SET_SOURCE_FILES_PROPERTIES( - ${${PROJECT_NAME}_MODULE_FILES} - PROPERTIES CPLUSPLUS ON - USE_TARGET_INCLUDE_DIRECTORIES TRUE - ) - -SWIG_ADD_LIBRARY(${${PROJECT_NAME}_MODULE} - TYPE SHARED - LANGUAGE python - SOURCES ${${PROJECT_NAME}_MODULE_FILES}) - -set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY CXX_STANDARD 11) -if(UNIX AND CMAKE_SIZEOF_VOID_P EQUAL 8) - set_property(TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_COMPILE_DEFINITIONS SWIGWORDSIZE64) -endif() - -target_link_libraries(${${PROJECT_NAME}_MODULE} - Python3::Module - fastdds - ${PROJECT_NAME} - ) - -# Find the installation path -execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils import sysconfig; print(sysconfig.get_python_lib(plat_specific=True, prefix='${CMAKE_INSTALL_PREFIX}'))" - OUTPUT_VARIABLE _ABS_PYTHON_MODULE_PATH - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - -get_filename_component (_ABS_PYTHON_MODULE_PATH ${_ABS_PYTHON_MODULE_PATH} ABSOLUTE) -file (RELATIVE_PATH _REL_PYTHON_MODULE_PATH ${CMAKE_INSTALL_PREFIX} ${_ABS_PYTHON_MODULE_PATH}) -SET (PYTHON_MODULE_PATH - ${_REL_PYTHON_MODULE_PATH}/${PROJECT_NAME} - ) - -# Install -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION bin/ - LIBRARY DESTINATION lib/ - ARCHIVE DESTINATION lib/ - ) -install(TARGETS ${${PROJECT_NAME}_MODULE} DESTINATION ${PYTHON_MODULE_PATH}) -get_property(support_files TARGET ${${PROJECT_NAME}_MODULE} PROPERTY SWIG_SUPPORT_FILES) -install(FILES ${support_files} DESTINATION ${PYTHON_MODULE_PATH} RENAME __init__.py) - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator.hpp b/fastdds_python_examples/RPCExample/generated_code/calculator.hpp deleted file mode 100644 index a4440464..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator.hpp +++ /dev/null @@ -1,86 +0,0 @@ -// 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 calculator.hpp - * This header file contains the declaration of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen (version: 4.0.4). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_HPP -#define FAST_DDS_GENERATED__CALCULATOR_HPP - -#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(CALCULATOR_SOURCE) -#define CALCULATOR_DllAPI __declspec( dllexport ) -#else -#define CALCULATOR_DllAPI __declspec( dllimport ) -#endif // CALCULATOR_SOURCE -#else -#define CALCULATOR_DllAPI -#endif // EPROSIMA_USER_DLL_EXPORT -#else -#define CALCULATOR_DllAPI -#endif // _WIN32 - -namespace calculator_base { - -/*! - * @brief This class represents the interface Adder defined by the user in the IDL file. - * @ingroup calculator - */ -class CALCULATOR_DllAPI Adder -{ -public: - -}; -/*! - * @brief This class represents the interface Subtractor defined by the user in the IDL file. - * @ingroup calculator - */ -class CALCULATOR_DllAPI Subtractor -{ -public: - -}; - -} // namespace calculator_base -/*! - * @brief This class represents the interface Calculator defined by the user in the IDL file. - * @ingroup calculator - */ -class CALCULATOR_DllAPI Calculator : public calculator_base::Adder, public calculator_base::Subtractor -{ -public: - -}; - -#endif // _FAST_DDS_GENERATED_CALCULATOR_HPP_ - - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator.i b/fastdds_python_examples/RPCExample/generated_code/calculator.i deleted file mode 100644 index 1514ce58..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator.i +++ /dev/null @@ -1,79 +0,0 @@ -// 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 calculator.i - * This header file contains the SWIG interface of the described types in the IDL file. - * - * This file was generated by the tool fastddsgen (version: 4.0.4). - */ - -%module(moduleimport="if __import__('os').name == 'nt': import win32api; win32api.LoadLibrary('calculator.dll')\nif __package__ or '.' in __name__:\n from . import _calculatorWrapper\nelse:\n import _calculatorWrapper") calculator - -// If using windows in debug, it would try to use python_d, which would not be found. -%begin %{ -#ifdef _MSC_VER -#define SWIG_PYTHON_INTERPRETER_NO_DEBUG -#endif -#include -%} - -// SWIG helper modules -%include "stdint.i" -%include "std_array.i" -%include "std_map.i" -%include "std_string.i" -%include "std_vector.i" -%include "typemaps.i" - -// Assignemt operators are ignored, as there is no such thing in Python. -// Trying to export them issues a warning -%ignore *::operator=; - -// Macro declarations -// Any macro used on the Fast DDS header files will give an error if it is not redefined here -#define FASTDDS_EXPORTED_API -#define eProsima_user_DllExport - - -%{ -#include "calculator.hpp" - -#include -%} - -%include -%import(module="fastdds") "fastdds/dds/core/LoanableCollection.hpp" -%import(module="fastdds") "fastdds/dds/core/LoanableTypedCollection.hpp" -%import(module="fastdds") "fastdds/dds/core/LoanableSequence.hpp" - -%define %traits_penumn(Type...) - %fragment(SWIG_Traits_frag(Type),"header", - fragment="StdTraits") { -namespace swig { - template <> struct traits< Type > { - typedef value_category category; - static const char* type_name() { return #Type; } - }; -} -} -%enddef - - -// Include the class interfaces -%include "calculator.hpp" - -// Include the corresponding TopicDataType -%include "calculatorPubSubTypes.i" - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp deleted file mode 100644 index 9aa0aa1c..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.hpp +++ /dev/null @@ -1,40 +0,0 @@ -// 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 calculatorCdrAux.hpp - * This source file contains some definitions of CDR related functions. - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP -#define FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP - -#include "calculator.hpp" -#include "calculator_details.hpp" - - -namespace eprosima { -namespace fastcdr { - -class Cdr; -class CdrSizeCalculator; - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CALCULATORCDRAUX_HPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp b/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp deleted file mode 100644 index 540332ad..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorCdrAux.ipp +++ /dev/null @@ -1,1195 +0,0 @@ -// 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 calculatorCdrAux.ipp - * This source file contains some declarations of CDR related functions. - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP -#define FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP - -#include "calculatorCdrAux.hpp" - -#include -#include - - -#include -using namespace eprosima::fastcdr::exception; - -namespace eprosima { -namespace fastcdr { - -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const calculator_base::OverflowException& data, - size_t& current_alignment) -{ - using namespace calculator_base; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - std::string msg = data.what(); - calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), msg, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const calculator_base::OverflowException& data) -{ - using namespace calculator_base; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr << eprosima::fastcdr::MemberId(0) << data.what(); - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - calculator_base::OverflowException& data) -{ - using namespace calculator_base; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - { - std::string msg; - dcdr >> msg; - calculator_base::OverflowException tmp{msg}; - data = tmp; - break; - } - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -//{ calculator_base::Adder interface - -//{ addition -// Serialization methods for calculator_base::detail::Adder_addition_In -/* -struct Adder_addition_In -{ - int32_t value1; - int32_t value2; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_In& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.value1, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.value2, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_In& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.value1 - << eprosima::fastcdr::MemberId(1) << data.value2 -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_In& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.value1; - break; - - case 1: - dcdr >> data.value2; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -// Serialization methods for calculator_base::detail::Adder_addition_Out -/* -struct Adder_addition_Out -{ - int32_t return_; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_Out& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.return_, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Out& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.return_ -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_Out& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.return_; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for calculator_base::detail::Adder_addition_Result -/* -struct Adder_addition_Result -{ - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Adder_addition_Result& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0254c1f7), - data.calculator_base_OverflowException_ex, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Result& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result - << eprosima::fastcdr::MemberId(0x0254c1f7) << data.calculator_base_OverflowException_ex -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Adder_addition_Result& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - case 0x0254c1f7: - dcdr >> data.calculator_base_OverflowException_ex; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Adder_addition_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // addition - - -//} // calculator_base::Adder interface - -//{ calculator_base::Subtractor interface - -//{ subtraction -// Serialization methods for calculator_base::detail::Subtractor_subtraction_In -/* -struct Subtractor_subtraction_In -{ - int32_t value1; - int32_t value2; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_In& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.value1, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.value2, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.value1 - << eprosima::fastcdr::MemberId(1) << data.value2 -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.value1; - break; - - case 1: - dcdr >> data.value2; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - - -// Serialization methods for calculator_base::detail::Subtractor_subtraction_Out -/* -struct Subtractor_subtraction_Out -{ - int32_t return_; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_Out& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.return_, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.return_ -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.return_; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for calculator_base::detail::Subtractor_subtraction_Result -/* -struct Subtractor_subtraction_Result -{ - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::calculator_base::detail::Subtractor_subtraction_Result& data, - size_t& current_alignment) -{ - using namespace calculator_base::detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0254c1f7), - data.calculator_base_OverflowException_ex, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - using namespace calculator_base::detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result - << eprosima::fastcdr::MemberId(0x0254c1f7) << data.calculator_base_OverflowException_ex -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - using namespace calculator_base::detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - case 0x0254c1f7: - dcdr >> data.calculator_base_OverflowException_ex; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::calculator_base::detail::Subtractor_subtraction_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // subtraction - - -//} // calculator_base::Subtractor interface - -//{ Calculator interface - -//{ representation_limits -// Serialization methods for detail::Calculator_representation_limits_In -/* -struct Calculator_representation_limits_In -{ -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_In& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_In& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - static_cast(data); - - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_In& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - static_cast(data); - static_cast(dcdr); - static_cast(mid); - return false; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_In& data) -{ - static_cast(scdr); - static_cast(data); -} - - -// Serialization methods for detail::Calculator_representation_limits_Out -/* -struct Calculator_representation_limits_Out -{ - int32_t min_value; - int32_t max_value; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_Out& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0), - data.min_value, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(1), - data.max_value, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Out& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR); - - scdr - << eprosima::fastcdr::MemberId(0) << data.min_value - << eprosima::fastcdr::MemberId(1) << data.max_value -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_Out& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0: - dcdr >> data.min_value; - break; - - case 1: - dcdr >> data.max_value; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Out& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for detail::Calculator_representation_limits_Result -/* -struct Calculator_representation_limits_Result -{ - eprosima::fastcdr::optional result; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_representation_limits_Result& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0784a8b4), - data.result, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Result& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x0784a8b4) << data.result -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_representation_limits_Result& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x0784a8b4: - dcdr >> data.result; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_representation_limits_Result& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // representation_limits - - -//{ top level - -// Serialization methods for detail::Calculator_Request -/* -struct Calculator_Request -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_Request& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x04e82a2b), - data.addition, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x096bbc8d), - data.subtraction, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0e205a8d), - data.representation_limits, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Request& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x04e82a2b) << data.addition - << eprosima::fastcdr::MemberId(0x096bbc8d) << data.subtraction - << eprosima::fastcdr::MemberId(0x0e205a8d) << data.representation_limits -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_Request& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x04e82a2b: - dcdr >> data.addition; - break; - - case 0x096bbc8d: - dcdr >> data.subtraction; - break; - - case 0x0e205a8d: - dcdr >> data.representation_limits; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Request& data) -{ - static_cast(scdr); - static_cast(data); -} - -// Serialization methods for detail::Calculator_Reply -/* -struct Calculator_Reply -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; - eprosima::fastcdr::optional remoteEx; -}; -*/ -template<> -eProsima_user_DllExport size_t calculate_serialized_size( - eprosima::fastcdr::CdrSizeCalculator& calculator, - const ::detail::Calculator_Reply& data, - size_t& current_alignment) -{ - using namespace detail; - - static_cast(data); - - eprosima::fastcdr::EncodingAlgorithmFlag previous_encoding = calculator.get_encoding(); - size_t calculated_size {calculator.begin_calculate_type_serialized_size( - eprosima::fastcdr::CdrVersion::XCDRv2 == calculator.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - current_alignment)}; - - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x04e82a2b), - data.addition, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x096bbc8d), - data.subtraction, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0e205a8d), - data.representation_limits, current_alignment); - - calculated_size += calculator.calculate_member_serialized_size(eprosima::fastcdr::MemberId(0x0f8e48f0), - data.remoteEx, current_alignment); - - - calculated_size += calculator.end_calculate_type_serialized_size(previous_encoding, current_alignment); - - return calculated_size; -} - -template<> -eProsima_user_DllExport void serialize( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Reply& data) -{ - using namespace detail; - - eprosima::fastcdr::Cdr::state current_state(scdr); - scdr.begin_serialize_type(current_state, - eprosima::fastcdr::CdrVersion::XCDRv2 == scdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR); - - scdr - << eprosima::fastcdr::MemberId(0x04e82a2b) << data.addition - << eprosima::fastcdr::MemberId(0x096bbc8d) << data.subtraction - << eprosima::fastcdr::MemberId(0x0e205a8d) << data.representation_limits - << eprosima::fastcdr::MemberId(0x0f8e48f0) << data.remoteEx -; - scdr.end_serialize_type(current_state); -} - -template<> -eProsima_user_DllExport void deserialize( - eprosima::fastcdr::Cdr& cdr, - ::detail::Calculator_Reply& data) -{ - using namespace detail; - - cdr.deserialize_type(eprosima::fastcdr::CdrVersion::XCDRv2 == cdr.get_cdr_version() ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2 : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR, - [&data](eprosima::fastcdr::Cdr& dcdr, const eprosima::fastcdr::MemberId& mid) -> bool - { - bool ret_value = true; - switch (mid.id) - { - case 0x04e82a2b: - dcdr >> data.addition; - break; - - case 0x096bbc8d: - dcdr >> data.subtraction; - break; - - case 0x0e205a8d: - dcdr >> data.representation_limits; - break; - - case 0x0f8e48f0: - dcdr >> data.remoteEx; - break; - - default: - ret_value = false; - break; - } - return ret_value; - }); -} - -void serialize_key( - eprosima::fastcdr::Cdr& scdr, - const ::detail::Calculator_Reply& data) -{ - static_cast(scdr); - static_cast(data); -} - -//} // top level - -//} // Calculator interface - - -} // namespace fastcdr -} // namespace eprosima - -#endif // FAST_DDS_GENERATED__CALCULATORCDRAUX_IPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx deleted file mode 100644 index 89e9c8a4..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.cxx +++ /dev/null @@ -1,568 +0,0 @@ -// 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 calculatorClient.cxx - * Client implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#include "calculatorClient.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" -#include "calculator_details.hpp" -#include "calculatorPubSubTypes.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -namespace detail { - -namespace fdds = eprosima::fastdds::dds; -namespace frpc = eprosima::fastdds::dds::rpc; -namespace frtps = eprosima::fastdds::rtps; - -class CalculatorClient : public Calculator -{ - - using RequestType = Calculator_Request; - using ReplyType = Calculator_Reply; - -public: - - CalculatorClient( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::RequesterQos& qos) - : Calculator() - , participant_(part) - { - // Register the service type support - auto service_type = create_Calculator_service_type_support(); - auto ret = service_type.register_service_type(&participant_, "Calculator"); - if (ret != fdds::RETCODE_OK) - { - throw std::runtime_error("Error registering service type"); - } - - // Create the service - service_ = participant_.create_service(service_name, "Calculator"); - if (nullptr == service_) - { - throw std::runtime_error("Error creating service"); - } - - // Create the requester - requester_ = participant_.create_service_requester(service_, qos); - if (nullptr == requester_) - { - throw std::runtime_error("Error creating requester"); - } - - // Start the processing thread - start_thread(); - } - - ~CalculatorClient() override - { - // Stop the processing thread - stop_thread(); - - // Destroy the requester - if (nullptr != requester_) - { - participant_.delete_service_requester(service_->get_service_name(), requester_); - requester_ = nullptr; - } - - // Destroy the service - if (nullptr != service_) - { - participant_.delete_service(service_); - service_ = nullptr; - } - } - -private: - - void start_thread() - { - stop_thread_ = false; - processing_thread_ = std::thread(&CalculatorClient::run, this); - } - - void stop_thread() - { - stop_thread_ = true; - if (processing_thread_.joinable()) - { - processing_thread_.join(); - } - } - - void run() - { - while (!stop_thread_) - { - // Wait for a reply - if (requester_->get_requester_reader()->wait_for_unread_message({ 0, 100000000 })) - { - // Take and process the reply - frpc::RequestInfo req_info; - ReplyType reply; - auto ret = requester_->take_reply(&reply, req_info); - if (ret == fdds::RETCODE_OK) - { - process_reply(reply, req_info); - } - } - } - } - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info) - { - auto sample_id = req_info.related_sample_identity; - { - std::lock_guard _(mtx_); - auto it = pending_results_.find(sample_id); - if (it != pending_results_.end()) - { - bool should_erase = false; - it->second->process_reply(reply, req_info, should_erase); - if (should_erase) - { - pending_results_.erase(it); - } - } - } - } - - struct IReplyProcessor - { - frpc::RequestInfo info; - - virtual ~IReplyProcessor() = default; - - virtual void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) = 0; - - }; - - fdds::DomainParticipant& participant_; - frpc::Service* service_ = nullptr; - frpc::Requester* requester_ = nullptr; - std::atomic stop_thread_{false}; - std::thread processing_thread_; - std::mutex mtx_; - std::map> pending_results_; - - //{ request helpers - - template - std::future send_request_with_promise( - const RequestType& request, - std::shared_ptr result, - std::promise& promise) - { - result->info.related_sample_identity.writer_guid(requester_->get_requester_reader()->guid()); - if (fdds::RETCODE_OK == requester_->send_request((void*)&request, result->info)) - { - std::lock_guard _ (mtx_); - pending_results_[result->info.related_sample_identity] = result; - } - else - { - promise.set_exception( - std::make_exception_ptr(frpc::RpcBrokenPipeException(false))); - } - - return promise.get_future(); - } - - template - std::shared_ptr send_request_with_reader( - const RequestType& request, - std::shared_ptr result) - { - result->info.related_sample_identity.writer_guid(requester_->get_requester_reader()->guid()); - if (fdds::RETCODE_OK == requester_->send_request((void*)&request, result->info)) - { - std::lock_guard _ (mtx_); - pending_results_[result->info.related_sample_identity] = result; - } - else - { - result->set_exception( - std::make_exception_ptr(frpc::RpcBrokenPipeException(false))); - } - - return result; - } - - //} request helpers - - //{ reply helpers - - template - static void set_invalid_reply( - T& exception_receiver) - { - exception_receiver.set_exception( - std::make_exception_ptr(frpc::RemoteInvalidArgumentError("An invalid reply was received"))); - } - - template - static void set_remote_exception( - T& exception_receiver, - const frpc::RemoteExceptionCode_t& exception) - { - switch (exception) - { - case frpc::RemoteExceptionCode_t::REMOTE_EX_OK: - set_invalid_reply(exception_receiver); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_UNSUPPORTED: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnsupportedError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteInvalidArgumentError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_OUT_OF_RESOURCES: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteOutOfResourcesError())); - break; - case frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_OPERATION: - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnknownOperationError())); - break; - default: // REMOTE_EX_UNKNOWN_EXCEPTION - exception_receiver.set_exception(std::make_exception_ptr(frpc::RemoteUnknownExceptionError())); - break; - } - } - - static size_t count_reply_fields( - const ReplyType& reply) - { - size_t n_fields = 0; - n_fields += reply.addition.has_value() ? 1 : 0; - n_fields += reply.subtraction.has_value() ? 1 : 0; - n_fields += reply.representation_limits.has_value() ? 1 : 0; - n_fields += reply.remoteEx.has_value() ? 1 : 0; - return n_fields; - } - - template - static bool validate_reply( - std::promise& promise, - const ReplyType& reply) - { - // Check if the reply has one and only one field set - size_t n_fields = count_reply_fields(reply); - if (n_fields != 1u) - { - set_invalid_reply(promise); - return false; - } - - return true; - } - - struct IExceptionHolder - { - virtual ~IExceptionHolder() = default; - - virtual void set_exception( - std::exception_ptr exception) = 0; - }; - - static bool validate_reply( - IExceptionHolder& reader, - const ReplyType& reply) - { - // Check if the reply has one and only one field set - size_t n_fields = count_reply_fields(reply); - if (n_fields != 1u) - { - set_invalid_reply(reader); - return false; - } - return true; - } - - //} reply helpers - - //{ operation addition - -public: - - eprosima::fastdds::dds::rpc::RpcFuture addition( - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.addition = calculator_base::detail::Adder_addition_In{}; - request.addition->value1 = value1; - request.addition->value2 = value2; - - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct addition_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.addition.has_value()) - { - const auto& result = reply.addition.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out.return_); - return; - } - if (result.calculator_base_OverflowException_ex.has_value()) - { - promise.set_exception( - std::make_exception_ptr(result.calculator_base_OverflowException_ex.value())); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation addition - - //{ operation subtraction - -public: - - eprosima::fastdds::dds::rpc::RpcFuture subtraction( - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.subtraction = calculator_base::detail::Subtractor_subtraction_In{}; - request.subtraction->value1 = value1; - request.subtraction->value2 = value2; - - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct subtraction_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.subtraction.has_value()) - { - const auto& result = reply.subtraction.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out.return_); - return; - } - if (result.calculator_base_OverflowException_ex.has_value()) - { - promise.set_exception( - std::make_exception_ptr(result.calculator_base_OverflowException_ex.value())); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation subtraction - - //{ operation representation_limits - -public: - - eprosima::fastdds::dds::rpc::RpcFuture representation_limits( -) override - { - // Create a promise to hold the result - auto result = std::make_shared(); - - // Create and send the request - RequestType request; - request.representation_limits = detail::Calculator_representation_limits_In{}; - return send_request_with_promise(request, result, result->promise); - } - -private: - - struct representation_limits_promise : public IReplyProcessor - { - std::promise promise; - - void process_reply( - const ReplyType& reply, - const frpc::RequestInfo& req_info, - bool& should_remove) override - { - should_remove = false; - if (req_info.related_sample_identity != info.related_sample_identity) - { - return; - } - - should_remove = true; - if (!validate_reply(promise, reply)) - { - return; - } - - if (reply.remoteEx.has_value()) - { - set_remote_exception(promise, reply.remoteEx.value()); - return; - } - - if (reply.representation_limits.has_value()) - { - const auto& result = reply.representation_limits.value(); - if (result.result.has_value()) - { - const auto& out = result.result.value(); - promise.set_value(out); - return; - } - } - - // If we reach this point, the reply is for another operation - set_invalid_reply(promise); - } - - }; - - - - //} operation representation_limits - - -}; - -} // namespace detail - -std::shared_ptr create_CalculatorClient( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::RequesterQos& qos) -{ - return std::make_shared(part, service_name, qos); -} - -//} interface CalculatorClient diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp deleted file mode 100644 index 21a4237b..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorClient.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// 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 calculatorClient.hpp - * Client implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP -#define FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP - -#include - -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -extern eProsima_user_DllExport std::shared_ptr create_CalculatorClient( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::RequesterQos& qos); - - -#endif // FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx deleted file mode 100644 index cb1f61b3..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.cxx +++ /dev/null @@ -1,349 +0,0 @@ -// 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 calculatorPubSubTypes.cpp - * This header file contains the implementation of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#include "calculatorPubSubTypes.hpp" - -#include -#include - -#include "calculatorCdrAux.hpp" -#include "calculatorTypeObjectSupport.hpp" - -using SerializedPayload_t = eprosima::fastdds::rtps::SerializedPayload_t; -using InstanceHandle_t = eprosima::fastdds::rtps::InstanceHandle_t; -using DataRepresentationId_t = eprosima::fastdds::dds::DataRepresentationId_t; - -namespace calculator_base { -} // namespace calculator_base - -// { Calculator interface - -class Calculator_RequestPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - // Alias for the type to be serialized. - typedef detail::Calculator_Request type; - - // Constructor - Calculator_RequestPubSubType() - { - set_name("Calculator_Request"); - uint32_t type_size = 56UL; - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - max_serialized_type_size = type_size + 4; /*encapsulation*/ - is_compute_key_provided = false; - } - - // Destructor - ~Calculator_RequestPubSubType() override = default; - - // This function serializes the data. - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - const type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2); - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - ser.set_dds_cdr_options({0,0}); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload.length = static_cast(ser.get_serialized_data_length()); - return true; - } - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - void* data) override - { - try - { - // Convert DATA to pointer of your type - type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); - - // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - deser >> *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; - } - - eProsima_user_DllExport uint32_t calculate_serialized_size( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } - - eProsima_user_DllExport bool compute_key( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(payload); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport bool compute_key( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(data); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport void* create_data() override - { - return new type(); - } - - eProsima_user_DllExport void delete_data( - void* data) override - { - type* pData = static_cast(data); - delete pData; - } - - eProsima_user_DllExport void register_type_object_representation() override - { - register_Calculator_Request_type_identifier(type_identifiers_); - } - -}; - -class Calculator_ReplyPubSubType : public eprosima::fastdds::dds::TopicDataType -{ -public: - // Alias for the type to be serialized. - typedef detail::Calculator_Reply type; - - // Constructor - Calculator_ReplyPubSubType() - { - set_name("Calculator_Reply"); - uint32_t type_size = 56UL; - type_size += static_cast(eprosima::fastcdr::Cdr::alignment(type_size, 4)); /* possible submessage alignment */ - max_serialized_type_size = type_size + 4; /*encapsulation*/ - is_compute_key_provided = false; - } - - // Destructor - ~Calculator_ReplyPubSubType() override = default; - - // This function serializes the data. - eProsima_user_DllExport bool serialize( - const void* const data, - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - const type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.max_size); - // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN, - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - payload.encapsulation = ser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - ser.set_encoding_flag( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR : - eprosima::fastcdr::EncodingAlgorithmFlag::PL_CDR2); - - try - { - // Serialize encapsulation - ser.serialize_encapsulation(); - // Serialize the object. - ser << *p_type; - ser.set_dds_cdr_options({0,0}); - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - // Get the serialized length - payload.length = static_cast(ser.get_serialized_data_length()); - return true; - } - - eProsima_user_DllExport bool deserialize( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - void* data) override - { - try - { - // Convert DATA to pointer of your type - type* p_type = static_cast(data); - - // Object that manages the raw buffer. - eprosima::fastcdr::FastBuffer fastbuffer(reinterpret_cast(payload.data), payload.length); - - // Object that deserializes the data. - eprosima::fastcdr::Cdr deser(fastbuffer, eprosima::fastcdr::Cdr::DEFAULT_ENDIAN); - - // Deserialize encapsulation. - deser.read_encapsulation(); - payload.encapsulation = deser.endianness() == eprosima::fastcdr::Cdr::BIG_ENDIANNESS ? CDR_BE : CDR_LE; - - // Deserialize the object. - deser >> *p_type; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return false; - } - - return true; - } - - eProsima_user_DllExport uint32_t calculate_serialized_size( - const void* const data, - eprosima::fastdds::dds::DataRepresentationId_t data_representation) override - { - try - { - eprosima::fastcdr::CdrSizeCalculator calculator( - data_representation == DataRepresentationId_t::XCDR_DATA_REPRESENTATION ? - eprosima::fastcdr::CdrVersion::XCDRv1 : eprosima::fastcdr::CdrVersion::XCDRv2); - size_t current_alignment {0}; - return static_cast(calculator.calculate_serialized_size( - *static_cast(data), current_alignment)) + - 4u /*encapsulation*/; - } - catch (eprosima::fastcdr::exception::Exception& /*exception*/) - { - return 0; - } - } - - eProsima_user_DllExport bool compute_key( - eprosima::fastdds::rtps::SerializedPayload_t& payload, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(payload); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport bool compute_key( - const void* const data, - eprosima::fastdds::rtps::InstanceHandle_t& ihandle, - bool force_md5 = false) override - { - static_cast(data); - static_cast(ihandle); - static_cast(force_md5); - return false; - } - - eProsima_user_DllExport void* create_data() override - { - return new type(); - } - - eProsima_user_DllExport void delete_data( - void* data) override - { - type* pData = static_cast(data); - delete pData; - } - - eProsima_user_DllExport void register_type_object_representation() override - { - register_Calculator_Reply_type_identifier(type_identifiers_); - } - -}; - -eprosima::fastdds::dds::rpc::ServiceTypeSupport create_Calculator_service_type_support() -{ - eprosima::fastdds::dds::TypeSupport request_type( - new Calculator_RequestPubSubType()); - eprosima::fastdds::dds::TypeSupport reply_type( - new Calculator_ReplyPubSubType()); - return eprosima::fastdds::dds::rpc::ServiceTypeSupport( - request_type, reply_type); -} - -// } // Calculator interface - - -// Include auxiliary functions like for serializing/deserializing. -#include "calculatorCdrAux.ipp" diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp deleted file mode 100644 index 2f39cd87..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// 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 calculatorPubSubTypes.hpp - * This header file contains the declaration of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.0.4). - */ - - -#ifndef FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP -#define FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP - -#include -#include -#include -#include -#include - -#include "calculator.hpp" - - -#if !defined(FASTDDS_GEN_API_VER) || (FASTDDS_GEN_API_VER != 3) -#error \ - Generated calculator is not compatible with current installed Fast DDS. Please, regenerate it with fastddsgen. -#endif // FASTDDS_GEN_API_VER - -namespace calculator_base -{ -} // namespace calculator_base - -#endif // FAST_DDS_GENERATED__CALCULATOR_PUBSUBTYPES_HPP - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i b/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i deleted file mode 100644 index 188b6d7e..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorPubSubTypes.i +++ /dev/null @@ -1,30 +0,0 @@ -// 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 calculatorPubSubTypes.i - * This header file contains the SWIG interface of the serialization functions. - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -%import(module="fastdds") "fastdds/dds/topic/TopicDataType.hpp"; - -%{ -#include "calculatorPubSubTypes.hpp" -%} - -#define FASTDDS_GEN_API_VER 3 - -%include "calculatorPubSubTypes.hpp" diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx deleted file mode 100644 index c3432ca7..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.cxx +++ /dev/null @@ -1,687 +0,0 @@ -// 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 calculatorServer.cxx - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#include "calculatorServer.hpp" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" -#include "calculator_details.hpp" -#include "calculatorPubSubTypes.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -namespace detail { - -namespace fdds = eprosima::fastdds::dds; -namespace frpc = eprosima::fastdds::dds::rpc; -namespace frtps = eprosima::fastdds::rtps; - -class CalculatorServerLogic - : public frpc::RpcServer - , public std::enable_shared_from_this -{ - using RequestType = Calculator_Request; - using ReplyType = Calculator_Reply; - -public: - - CalculatorServerLogic( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation) - : CalculatorServerLogic( - part, - service_name, - qos, - std::make_shared(*this, thread_pool_size), - std::move(implementation)) - { - } - - CalculatorServerLogic( - fdds::DomainParticipant& part, - const char* service_name, - const fdds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation) - : frpc::RpcServer() - , participant_(part) - , request_scheduler_(scheduler) - , implementation_(std::move(implementation)) - { - // Register the service type support - auto service_type = create_Calculator_service_type_support(); - auto ret = service_type.register_service_type(&participant_, "Calculator"); - if (ret != fdds::RETCODE_OK) - { - throw std::runtime_error("Error registering service type"); - } - - // Create the service - service_ = participant_.create_service(service_name, "Calculator"); - if (nullptr == service_) - { - throw std::runtime_error("Error creating service"); - } - - // Create the replier - replier_ = participant_.create_service_replier(service_, qos); - if (nullptr == replier_) - { - throw std::runtime_error("Error creating requester"); - } - } - - ~CalculatorServerLogic() override - { - if (nullptr != replier_) - { - participant_.delete_service_replier(service_->get_service_name(), replier_); - } - - if (nullptr != service_) - { - participant_.delete_service(service_); - } - } - - void run() override - { - finish_condition_.set_trigger_value(false); - fdds::WaitSet waitset; - waitset.attach_condition(finish_condition_); - fdds::StatusCondition& status_condition = replier_->get_replier_reader()->get_statuscondition(); - status_condition.set_enabled_statuses(fdds::StatusMask::data_available()); - waitset.attach_condition(status_condition); - - while (true) - { - fdds::ConditionSeq active_conditions; - waitset.wait(active_conditions, fdds::c_TimeInfinite); - - // Early exit if the finish condition is triggered - if (finish_condition_.get_trigger_value()) - { - break; - } - - // Take and process the requests - auto ctx = std::make_shared(); - while (fdds::RETCODE_OK == ctx->take_from(replier_)) - { - if (ctx->validate_request()) - { - process_request(ctx); - } - else - { - ctx->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT, replier_); - } - - // Prepare next request context - ctx = std::make_shared(); - } - } - } - - void stop() override - { - // Notify all threads to finish - finish_condition_.set_trigger_value(true); - - // Cancel all pending requests - { - std::lock_guard _(mtx_); - for (auto& it : processing_requests_) - { - it.second->cancel(); - } - processing_requests_.clear(); - } - - // Wait for all threads to finish - request_scheduler_->server_stopped(shared_from_this()); - } - - void execute_request( - const std::shared_ptr& request) override - { - auto ctx = std::dynamic_pointer_cast(request); - if (ctx) - { - execute_request(ctx); - } - else - { - throw std::runtime_error("Invalid request context type"); - } - } - -private: - - //{ Output feed helpers - - struct IOutputFeedCancellator - { - virtual ~IOutputFeedCancellator() = default; - virtual void cancel() = 0; - }; - - //} Output feed helpers - - //{ Input feed helpers - - struct IInputFeedProcessor - { - virtual ~IInputFeedProcessor() = default; - virtual bool process_additional_request( - const RequestType& request) = 0; - virtual void cancel_input_feed() = 0; - }; - - //} Input feed helpers - - //{ operation addition - - //} operation addition - - //{ operation subtraction - - //} operation subtraction - - //{ operation representation_limits - - //} operation representation_limits - - struct RequestContext : frpc::RpcRequest - { - RequestType request; - frpc::RequestInfo info; - frtps::GUID_t client_id; - fdds::PublicationBuiltinTopicData pub_data; - - struct addition_feeds_t - { - } - addition_feeds; - - struct subtraction_feeds_t - { - } - subtraction_feeds; - - struct representation_limits_feeds_t - { - } - representation_limits_feeds; - - const frtps::GUID_t& get_client_id() const override - { - return client_id; - } - - const frtps::RemoteLocatorList& get_client_locators() const override - { - return pub_data.remote_locators; - } - - fdds::ReturnCode_t take_from( - frpc::Replier* replier) - { - fdds::ReturnCode_t ret = replier->take_request(&request, info); - if (ret == fdds::RETCODE_OK) - { - client_id = info.sample_identity.writer_guid(); - ret = replier->get_replier_reader()->get_matched_publication_data(pub_data, client_id); - } - return ret; - } - - bool validate_request() const - { - size_t n_fields = 0; - n_fields += request.addition.has_value() ? 1 : 0; - n_fields += request.subtraction.has_value() ? 1 : 0; - n_fields += request.representation_limits.has_value() ? 1 : 0; - - return n_fields == 1U; - } - - void process_additional_request( - const std::shared_ptr& ctx, - frpc::Replier* replier, - bool& should_erase) - { - should_erase = false; - if (ctx->info.related_sample_identity == info.related_sample_identity) - { - // Pass request to input feed processors - should_erase = true; - for (const auto& input_feed : input_feed_processors_) - { - if (input_feed->process_additional_request(ctx->request)) - { - should_erase = false; - break; - } - } - - // If no input feed processor handled the request, send an exception - if (should_erase) - { - send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_INVALID_ARGUMENT, replier); - } - } - else - { - // This is not the expected request - should_erase = true; - } - } - - bool prepare( - frpc::Replier* replier) - { - if (request.addition.has_value()) - { - return prepare_addition(replier); - } - - if (request.subtraction.has_value()) - { - return prepare_subtraction(replier); - } - - if (request.representation_limits.has_value()) - { - return prepare_representation_limits(replier); - } - - - send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_OPERATION, replier); - return false; - } - - void send_exception( - frpc::RemoteExceptionCode_t ex, - frpc::Replier* replier) - { - ReplyType reply{}; - reply.remoteEx = ex; - replier->send_reply(&reply, info); - } - - void cancel() - { - // Cancel output feed - if (output_feed_cancellator_) - { - output_feed_cancellator_->cancel(); - } - - // Cancel input feeds - for (const auto& input_feed : input_feed_processors_) - { - input_feed->cancel_input_feed(); - } - } - - private: - - std::shared_ptr output_feed_cancellator_; - std::vector> input_feed_processors_; - - bool prepare_addition( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - bool prepare_subtraction( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - bool prepare_representation_limits( - frpc::Replier* replier) - { - static_cast(replier); - return true; - } - - }; - - struct ThreadPool - : public frpc::RpcServerSchedulingStrategy - { - ThreadPool( - CalculatorServerLogic& server, - size_t num_threads) - : server_(server) - { - // Create worker threads (at least one) - if (num_threads == 0) - { - num_threads = 1; - } - - auto process_requests = [this]() - { - while (!finished_) - { - std::shared_ptr req; - { - std::unique_lock lock(mtx_); - cv_.wait(lock, [this]() - { - return finished_ || !requests_.empty(); - }); - if (finished_) - { - break; - } - req = requests_.front(); - requests_.pop(); - } - - // Process the request - server_.execute_request(req); - } - }; - - for (size_t i = 0; i < num_threads; ++i) - { - threads_.emplace_back(process_requests); - } - } - - void schedule_request( - const std::shared_ptr& req, - const std::shared_ptr& server) override - { - static_cast(server); - - std::lock_guard lock(mtx_); - if (!finished_) - { - requests_.push(req); - cv_.notify_one(); - } - } - - void server_stopped( - const std::shared_ptr& server) override - { - static_cast(server); - - // Notify all threads in the pool to stop - { - std::lock_guard lock(mtx_); - finished_ = true; - cv_.notify_all(); - } - - // Wait for all threads to finish - for (auto& thread : threads_) - { - if (thread.joinable()) - { - thread.join(); - } - } - threads_.clear(); - } - - CalculatorServerLogic& server_; - std::mutex mtx_; - std::condition_variable cv_; - std::queue> requests_; - bool finished_{ false }; - std::vector threads_; - }; - - void process_request( - const std::shared_ptr& ctx) - { - auto id = ctx->info.related_sample_identity; - - { - std::lock_guard _(mtx_); - auto it = processing_requests_.find(id); - if (it != processing_requests_.end()) - { - bool should_erase = false; - it->second->process_additional_request(ctx, replier_, should_erase); - if (should_erase) - { - processing_requests_.erase(it); - } - return; - } - - if (!ctx->prepare(replier_)) - { - return; - } - - processing_requests_[id] = ctx; - } - - request_scheduler_->schedule_request(ctx, shared_from_this()); - } - - void execute_request( - const std::shared_ptr& req) - { - try - { - for (;;) - { - if (req->request.addition.has_value()) - { - try - { - ReplyType reply{}; - reply.addition = calculator_base::detail::Adder_addition_Result{}; - reply.addition->result = calculator_base::detail::Adder_addition_Out{}; - reply.addition->result->return_ = implementation_->addition( - *req, - req->request.addition->value1, - req->request.addition->value2); - replier_->send_reply(&reply, req->info); - } - catch (const calculator_base::OverflowException& ex) - { - ReplyType reply{}; - reply.addition = calculator_base::detail::Adder_addition_Result{}; - reply.addition->calculator_base_OverflowException_ex = ex; - replier_->send_reply(&reply, req->info); - } - break; - } - - if (req->request.subtraction.has_value()) - { - try - { - ReplyType reply{}; - reply.subtraction = calculator_base::detail::Subtractor_subtraction_Result{}; - reply.subtraction->result = calculator_base::detail::Subtractor_subtraction_Out{}; - reply.subtraction->result->return_ = implementation_->subtraction( - *req, - req->request.subtraction->value1, - req->request.subtraction->value2); - replier_->send_reply(&reply, req->info); - } - catch (const calculator_base::OverflowException& ex) - { - ReplyType reply{}; - reply.subtraction = calculator_base::detail::Subtractor_subtraction_Result{}; - reply.subtraction->calculator_base_OverflowException_ex = ex; - replier_->send_reply(&reply, req->info); - } - break; - } - - if (req->request.representation_limits.has_value()) - { - { - ReplyType reply{}; - reply.representation_limits = detail::Calculator_representation_limits_Result{}; - reply.representation_limits->result = implementation_->representation_limits( - *req); - replier_->send_reply(&reply, req->info); - } - break; - } - - req->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNSUPPORTED, replier_); - break; - } - } - catch (const frpc::RpcRemoteException& ex) - { - req->send_exception(ex.code(), replier_); - } - catch (...) - { - req->send_exception(frpc::RemoteExceptionCode_t::REMOTE_EX_UNKNOWN_EXCEPTION, replier_); - } - - { - std::lock_guard _(mtx_); - processing_requests_.erase(req->info.related_sample_identity); - } - } - - fdds::DomainParticipant& participant_; - frpc::Service* service_ = nullptr; - frpc::Replier* replier_ = nullptr; - fdds::GuardCondition finish_condition_; - std::mutex mtx_; - std::map> processing_requests_; - std::shared_ptr request_scheduler_; - std::shared_ptr implementation_; - -}; - -struct CalculatorServerProxy - : public frpc::RpcServer -{ - CalculatorServerProxy( - std::shared_ptr impl) - : impl_(std::move(impl)) - { - } - - ~CalculatorServerProxy() override - { - if (impl_) - { - impl_->stop(); - } - } - - void run() override - { - impl_->run(); - } - - void stop() override - { - impl_->stop(); - } - - void execute_request( - const std::shared_ptr& request) override - { - impl_->execute_request(request); - } - -private: - - std::shared_ptr impl_; -}; - -} // namespace detail - -std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation) -{ - auto ptr = std::make_shared( - part, service_name, qos, thread_pool_size, implementation); - return std::make_shared(ptr); -} - -std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation) -{ - auto ptr = std::make_shared( - part, service_name, qos, scheduler, implementation); - return std::make_shared(ptr); -} - -//} interface Calculator - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp deleted file mode 100644 index 90d73fdd..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServer.hpp +++ /dev/null @@ -1,98 +0,0 @@ -// 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 calculatorServer.hpp - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_SERVER_HPP -#define FAST_DDS_GENERATED__CALCULATOR_SERVER_HPP - -#include - -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -struct CalculatorServer_IServerImplementation -{ - virtual ~CalculatorServer_IServerImplementation() = default; - - virtual int32_t addition( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - - - - virtual int32_t subtraction( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) = 0; - - - - virtual detail::Calculator_representation_limits_Out representation_limits( - const eprosima::fastdds::dds::rpc::RpcRequest& info) = 0; - -}; - -/** - * @brief Create a Calculator server instance. - * - * @param part The DomainParticipant to use for the server. - * @param service_name The name of the service. - * @param qos The QoS settings for the server. - * @param thread_pool_size The size of the thread pool to use for processing requests. - * When set to 0, a pool with a single thread will be created. - * @param implementation The implementation of the server interface. - */ -extern eProsima_user_DllExport std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - size_t thread_pool_size, - std::shared_ptr implementation); - -/** - * @brief Create a Calculator server instance. - * - * @param part The DomainParticipant to use for the server. - * @param service_name The name of the service. - * @param qos The QoS settings for the server. - * @param scheduler The request scheduling strategy to use for the server. - * @param implementation The implementation of the server interface. - */ -extern eProsima_user_DllExport std::shared_ptr create_CalculatorServer( - eprosima::fastdds::dds::DomainParticipant& part, - const char* service_name, - const eprosima::fastdds::dds::ReplierQos& qos, - std::shared_ptr scheduler, - std::shared_ptr implementation); - - -#endif // FAST_DDS_GENERATED__CALCULATOR_CLIENT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp deleted file mode 100644 index 95efa78b..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorServerImpl.hpp +++ /dev/null @@ -1,73 +0,0 @@ -// 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 calculatorServerImpl.hpp - * Server implementation for interfaces - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP -#define FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP - -#include "calculator.hpp" -#include "calculatorServer.hpp" - -namespace calculator_base { - - -} // namespace calculator_base - -//{ interface Calculator - -struct CalculatorServerImplementation : - public CalculatorServer_IServerImplementation -{ - - int32_t addition( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - static_cast(info); - static_cast(value1); - static_cast(value2); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'addition' is not implemented"); - } - - int32_t subtraction( - const eprosima::fastdds::dds::rpc::RpcRequest& info, - /*in*/ int32_t value1, - /*in*/ int32_t value2) override - { - static_cast(info); - static_cast(value1); - static_cast(value2); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'subtraction' is not implemented"); - } - - detail::Calculator_representation_limits_Out representation_limits( - const eprosima::fastdds::dds::rpc::RpcRequest& info) override - { - static_cast(info); - throw eprosima::fastdds::dds::rpc::RemoteUnsupportedError("Operation 'representation_limits' is not implemented"); - } - -}; - -//} interface Calculator - - -#endif // FAST_DDS_GENERATED__CALCULATOR_SERVERIMPL_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx b/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx deleted file mode 100644 index c276a255..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.cxx +++ /dev/null @@ -1,43 +0,0 @@ -// 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 calculatorTypeObjectSupport.cxx - * Source file containing the implementation to register the TypeObject representation of the described types in the IDL file - * - * This file was generated by the tool fastddsgen (version: 4.0.4). - */ - -#include "calculatorTypeObjectSupport.hpp" - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "calculator.hpp" - - -using namespace eprosima::fastdds::dds::xtypes; - -namespace calculator_base { -} // namespace calculator_base - diff --git a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp b/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp deleted file mode 100644 index 6e73f86c..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculatorTypeObjectSupport.hpp +++ /dev/null @@ -1,46 +0,0 @@ -// 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 calculatorTypeObjectSupport.hpp - * Header file containing the API required to register the TypeObject representation of the described types in the IDL file - * - * This file was generated by the tool fastddsgen (version: 4.0.4). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP -#define FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP - -#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 - -#ifndef DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -namespace calculator_base { -} // namespace calculator_base - - -#endif // DOXYGEN_SHOULD_SKIP_THIS_PUBLIC - -#endif // FAST_DDS_GENERATED__CALCULATOR_TYPE_OBJECT_SUPPORT_HPP diff --git a/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp b/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp deleted file mode 100644 index e55cc0c7..00000000 --- a/fastdds_python_examples/RPCExample/generated_code/calculator_details.hpp +++ /dev/null @@ -1,135 +0,0 @@ -// 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 calculator_details.hpp - * This header file contains support data structures for RPC communication. - * - * This file was generated by the tool fastddsgen (version: 4.1.0). - */ - -#ifndef FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP -#define FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP - -#include -#include -#include - -#include "calculator.hpp" - -namespace calculator_base { - namespace detail { - - //{ Adder interface - - //{ addition - struct Adder_addition_In - { - int32_t value1; - int32_t value2; - }; - - - - struct Adder_addition_Out - { - int32_t return_; - }; - - struct Adder_addition_Result - { - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; - }; - - //} // addition - - - //} // Adder interface - - } // namespace detail - namespace detail { - - //{ Subtractor interface - - //{ subtraction - struct Subtractor_subtraction_In - { - int32_t value1; - int32_t value2; - }; - - - - struct Subtractor_subtraction_Out - { - int32_t return_; - }; - - struct Subtractor_subtraction_Result - { - eprosima::fastcdr::optional result; - eprosima::fastcdr::optional calculator_base_OverflowException_ex; - }; - - //} // subtraction - - - //} // Subtractor interface - - } // namespace detail -} // namespace calculator_base -namespace detail { - -//{ Calculator interface - -//{ representation_limits -struct Calculator_representation_limits_In -{ -}; - - - -struct Calculator_representation_limits_Result -{ - eprosima::fastcdr::optional result; -}; - -//} // representation_limits - - -//{ top level - -struct Calculator_Request -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; -}; - -struct Calculator_Reply -{ - eprosima::fastcdr::optional addition; - eprosima::fastcdr::optional subtraction; - eprosima::fastcdr::optional representation_limits; - eprosima::fastcdr::optional remoteEx; -}; - -//} // top level - -//} // Calculator interface - -} // namespace detail - -#endif //FAST_DDS_GENERATED__CALCULATOR_DETAILS_HPP \ No newline at end of file diff --git a/utils/scripts/update_generated_code_from_idl.sh b/utils/scripts/update_generated_code_from_idl.sh index 108f3939..00669a43 100755 --- a/utils/scripts/update_generated_code_from_idl.sh +++ b/utils/scripts/update_generated_code_from_idl.sh @@ -40,17 +40,4 @@ if [[ $? != 0 ]]; then fi cd - -if [[ $ret_value != -1 ]]; then - cd "./fastdds_python_examples/RPCExample" - -echo -e "Processing ${yellow}calculator.idl${textreset}" - echo "Running: fastddsgen -replace -python calculator.idl" - fastddsgen -replace -python -d generated_code calculator.idl -fi - -if [[ $? != 0 ]]; then - ret_value=-1 -fi -cd - - exit ${ret_value}