diff --git a/fastdds_python/test/types/test_completeCdrAux.ipp b/fastdds_python/test/types/test_completeCdrAux.ipp index 79915c10..3d86a41c 100644 --- a/fastdds_python/test/types/test_completeCdrAux.ipp +++ b/fastdds_python/test/types/test_completeCdrAux.ipp @@ -217,8 +217,43 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const StructType& data) { + extern void serialize_key( + Cdr& scdr, + const eprosima::test2::StructType2& data); + + static_cast(scdr); static_cast(data); + scdr << data.char_field(); + + scdr << data.uint8_field(); + + scdr << data.int16_field(); + + scdr << data.uint16_field(); + + scdr << data.int32_field(); + + scdr << data.uint32_field(); + + scdr << data.int64_field(); + + scdr << data.uint64_field(); + + scdr << data.float_field(); + + scdr << data.double_field(); + + scdr << data.bool_field(); + + scdr << data.string_field(); + + scdr << data.enum_field(); + + scdr << data.enum2_field(); + + serialize_key(scdr, data.included_module_struct()); + } @@ -863,8 +898,262 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const CompleteTestType& data) { + extern void serialize_key( + Cdr& scdr, + const StructType& data); + + + + + + + + + + + + + + + + extern void serialize_key( + Cdr& scdr, + const StructType& data); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static_cast(scdr); static_cast(data); + scdr << data.char_field(); + + scdr << data.uint8_field(); + + scdr << data.int16_field(); + + scdr << data.uint16_field(); + + scdr << data.int32_field(); + + scdr << data.uint32_field(); + + scdr << data.int64_field(); + + scdr << data.uint64_field(); + + scdr << data.float_field(); + + scdr << data.double_field(); + + scdr << data.bool_field(); + + scdr << data.string_field(); + + scdr << data.enum_field(); + + scdr << data.enum2_field(); + + serialize_key(scdr, data.struct_field()); + + if (data.char_opt_field().has_value()) + { + scdr << data.char_opt_field().value(); + } + + if (data.uint8_opt_field().has_value()) + { + scdr << data.uint8_opt_field().value(); + } + + if (data.int16_opt_field().has_value()) + { + scdr << data.int16_opt_field().value(); + } + + if (data.uint16_opt_field().has_value()) + { + scdr << data.uint16_opt_field().value(); + } + + if (data.int32_opt_field().has_value()) + { + scdr << data.int32_opt_field().value(); + } + + if (data.uint32_opt_field().has_value()) + { + scdr << data.uint32_opt_field().value(); + } + + if (data.int64_opt_field().has_value()) + { + scdr << data.int64_opt_field().value(); + } + + if (data.uint64_opt_field().has_value()) + { + scdr << data.uint64_opt_field().value(); + } + + if (data.float_opt_field().has_value()) + { + scdr << data.float_opt_field().value(); + } + + if (data.double_opt_field().has_value()) + { + scdr << data.double_opt_field().value(); + } + + if (data.bool_opt_field().has_value()) + { + scdr << data.bool_opt_field().value(); + } + + if (data.string_opt_field().has_value()) + { + scdr << data.string_opt_field().value(); + } + + if (data.enum_opt_field().has_value()) + { + scdr << data.enum_opt_field().value(); + } + + if (data.enum2_opt_field().has_value()) + { + scdr << data.enum2_opt_field().value(); + } + + if (data.struct_opt_field().has_value()) + { + serialize_key(scdr, data.struct_opt_field().value()); + } + + scdr << data.array_char_field(); + + scdr << data.array_uint8_field(); + + scdr << data.array_int16_field(); + + scdr << data.array_uint16_field(); + + scdr << data.array_int32_field(); + + scdr << data.array_uint32_field(); + + scdr << data.array_int64_field(); + + scdr << data.array_uint64_field(); + + scdr << data.array_float_field(); + + scdr << data.array_double_field(); + + scdr << data.array_bool_field(); + + scdr << data.array_enum_field(); + + scdr << data.array_enum2_field(); + + scdr << data.array_struct_field(); + + scdr << data.bounded_sequence_char_field(); + + scdr << data.bounded_sequence_uint8_field(); + + scdr << data.bounded_sequence_int16_field(); + + scdr << data.bounded_sequence_uint16_field(); + + scdr << data.bounded_sequence_int32_field(); + + scdr << data.bounded_sequence_uint32_field(); + + scdr << data.bounded_sequence_int64_field(); + + scdr << data.bounded_sequence_uint64_field(); + + scdr << data.bounded_sequence_float_field(); + + scdr << data.bounded_sequence_double_field(); + + scdr << data.bounded_sequence_bool_field(); + + scdr << data.bounded_sequence_enum_field(); + + scdr << data.bounded_sequence_enum2_field(); + + scdr << data.bounded_sequence_struct_field(); + + scdr << data.unbounded_sequence_char_field(); + + scdr << data.unbounded_sequence_uint8_field(); + + scdr << data.unbounded_sequence_int16_field(); + + scdr << data.unbounded_sequence_uint16_field(); + + scdr << data.unbounded_sequence_int32_field(); + + scdr << data.unbounded_sequence_uint32_field(); + + scdr << data.unbounded_sequence_int64_field(); + + scdr << data.unbounded_sequence_uint64_field(); + + scdr << data.unbounded_sequence_float_field(); + + scdr << data.unbounded_sequence_double_field(); + + scdr << data.unbounded_sequence_bool_field(); + + scdr << data.unbounded_sequence_enum_field(); + + scdr << data.unbounded_sequence_enum2_field(); + + scdr << data.unbounded_sequence_struct_field(); + } @@ -1515,9 +1804,74 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const KeyedCompleteTestType& data) { + extern void serialize_key( + Cdr& scdr, + const StructType& data); + + + + + + + + + + + + + + + + extern void serialize_key( + Cdr& scdr, + const StructType& data); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static_cast(scdr); static_cast(data); - scdr << data.id(); + scdr << data.id(); diff --git a/fastdds_python/test/types/test_completePubSubTypes.cxx b/fastdds_python/test/types/test_completePubSubTypes.cxx index 4ff52c5e..3801713e 100644 --- a/fastdds_python/test/types/test_completePubSubTypes.cxx +++ b/fastdds_python/test/types/test_completePubSubTypes.cxx @@ -184,7 +184,8 @@ bool StructTypePubSubType::compute_key( StructType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || StructType_max_key_cdr_typesize > 16) { @@ -366,7 +367,8 @@ bool CompleteTestTypePubSubType::compute_key( CompleteTestType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || CompleteTestType_max_key_cdr_typesize > 16) { @@ -546,7 +548,8 @@ bool KeyedCompleteTestTypePubSubType::compute_key( KeyedCompleteTestType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || KeyedCompleteTestType_max_key_cdr_typesize > 16) { diff --git a/fastdds_python/test/types/test_included_modulesCdrAux.ipp b/fastdds_python/test/types/test_included_modulesCdrAux.ipp index 663352f6..e362129b 100644 --- a/fastdds_python/test/types/test_included_modulesCdrAux.ipp +++ b/fastdds_python/test/types/test_included_modulesCdrAux.ipp @@ -219,6 +219,34 @@ void serialize_key( static_cast(scdr); static_cast(data); + scdr << data.char_field(); + + scdr << data.uint8_field(); + + scdr << data.int16_field(); + + scdr << data.uint16_field(); + + scdr << data.int32_field(); + + scdr << data.uint32_field(); + + scdr << data.int64_field(); + + scdr << data.uint64_field(); + + scdr << data.float_field(); + + scdr << data.double_field(); + + scdr << data.bool_field(); + + scdr << data.string_field(); + + scdr << data.enum_field(); + + scdr << data.enum2_field(); + } diff --git a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx index ce24f19a..a7559e7e 100644 --- a/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_included_modulesPubSubTypes.cxx @@ -186,7 +186,8 @@ namespace eprosima { eprosima_test2_StructType2_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || eprosima_test2_StructType2_max_key_cdr_typesize > 16) { diff --git a/fastdds_python/test/types/test_modulesCdrAux.ipp b/fastdds_python/test/types/test_modulesCdrAux.ipp index 2d6f8790..1024feac 100644 --- a/fastdds_python/test/types/test_modulesCdrAux.ipp +++ b/fastdds_python/test/types/test_modulesCdrAux.ipp @@ -219,6 +219,34 @@ void serialize_key( static_cast(scdr); static_cast(data); + scdr << data.char_field(); + + scdr << data.uint8_field(); + + scdr << data.int16_field(); + + scdr << data.uint16_field(); + + scdr << data.int32_field(); + + scdr << data.uint32_field(); + + scdr << data.int64_field(); + + scdr << data.uint64_field(); + + scdr << data.float_field(); + + scdr << data.double_field(); + + scdr << data.bool_field(); + + scdr << data.string_field(); + + scdr << data.enum_field(); + + scdr << data.enum2_field(); + } @@ -870,9 +898,262 @@ void serialize_key( const eprosima::test::CompleteTestType& data) { using namespace eprosima::test; + extern void serialize_key( + Cdr& scdr, + const eprosima::test::StructType& data); + + + + + + + + + + + + + + + + extern void serialize_key( + Cdr& scdr, + const eprosima::test::StructType& data); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static_cast(scdr); static_cast(data); + scdr << data.char_field(); + + scdr << data.uint8_field(); + + scdr << data.int16_field(); + + scdr << data.uint16_field(); + + scdr << data.int32_field(); + + scdr << data.uint32_field(); + + scdr << data.int64_field(); + + scdr << data.uint64_field(); + + scdr << data.float_field(); + + scdr << data.double_field(); + + scdr << data.bool_field(); + + scdr << data.string_field(); + + scdr << data.enum_field(); + + scdr << data.enum2_field(); + + serialize_key(scdr, data.struct_field()); + + if (data.char_opt_field().has_value()) + { + scdr << data.char_opt_field().value(); + } + + if (data.uint8_opt_field().has_value()) + { + scdr << data.uint8_opt_field().value(); + } + + if (data.int16_opt_field().has_value()) + { + scdr << data.int16_opt_field().value(); + } + + if (data.uint16_opt_field().has_value()) + { + scdr << data.uint16_opt_field().value(); + } + + if (data.int32_opt_field().has_value()) + { + scdr << data.int32_opt_field().value(); + } + + if (data.uint32_opt_field().has_value()) + { + scdr << data.uint32_opt_field().value(); + } + + if (data.int64_opt_field().has_value()) + { + scdr << data.int64_opt_field().value(); + } + + if (data.uint64_opt_field().has_value()) + { + scdr << data.uint64_opt_field().value(); + } + + if (data.float_opt_field().has_value()) + { + scdr << data.float_opt_field().value(); + } + + if (data.double_opt_field().has_value()) + { + scdr << data.double_opt_field().value(); + } + + if (data.bool_opt_field().has_value()) + { + scdr << data.bool_opt_field().value(); + } + + if (data.string_opt_field().has_value()) + { + scdr << data.string_opt_field().value(); + } + + if (data.enum_opt_field().has_value()) + { + scdr << data.enum_opt_field().value(); + } + + if (data.enum2_opt_field().has_value()) + { + scdr << data.enum2_opt_field().value(); + } + + if (data.struct_opt_field().has_value()) + { + serialize_key(scdr, data.struct_opt_field().value()); + } + + scdr << data.array_char_field(); + + scdr << data.array_uint8_field(); + + scdr << data.array_int16_field(); + + scdr << data.array_uint16_field(); + + scdr << data.array_int32_field(); + + scdr << data.array_uint32_field(); + + scdr << data.array_int64_field(); + + scdr << data.array_uint64_field(); + + scdr << data.array_float_field(); + + scdr << data.array_double_field(); + + scdr << data.array_bool_field(); + + scdr << data.array_enum_field(); + + scdr << data.array_enum2_field(); + + scdr << data.array_struct_field(); + + scdr << data.bounded_sequence_char_field(); + + scdr << data.bounded_sequence_uint8_field(); + + scdr << data.bounded_sequence_int16_field(); + + scdr << data.bounded_sequence_uint16_field(); + + scdr << data.bounded_sequence_int32_field(); + + scdr << data.bounded_sequence_uint32_field(); + + scdr << data.bounded_sequence_int64_field(); + + scdr << data.bounded_sequence_uint64_field(); + + scdr << data.bounded_sequence_float_field(); + + scdr << data.bounded_sequence_double_field(); + + scdr << data.bounded_sequence_bool_field(); + + scdr << data.bounded_sequence_enum_field(); + + scdr << data.bounded_sequence_enum2_field(); + + scdr << data.bounded_sequence_struct_field(); + + scdr << data.unbounded_sequence_char_field(); + + scdr << data.unbounded_sequence_uint8_field(); + + scdr << data.unbounded_sequence_int16_field(); + + scdr << data.unbounded_sequence_uint16_field(); + + scdr << data.unbounded_sequence_int32_field(); + + scdr << data.unbounded_sequence_uint32_field(); + + scdr << data.unbounded_sequence_int64_field(); + + scdr << data.unbounded_sequence_uint64_field(); + + scdr << data.unbounded_sequence_float_field(); + + scdr << data.unbounded_sequence_double_field(); + + scdr << data.unbounded_sequence_bool_field(); + + scdr << data.unbounded_sequence_enum_field(); + + scdr << data.unbounded_sequence_enum2_field(); + + scdr << data.unbounded_sequence_struct_field(); + } @@ -1530,10 +1811,74 @@ void serialize_key( const eprosima::test::KeyedCompleteTestType& data) { using namespace eprosima::test; + extern void serialize_key( + Cdr& scdr, + const eprosima::test::StructType& data); + + + + + + + + + + + + + + + + extern void serialize_key( + Cdr& scdr, + const eprosima::test::StructType& data); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + static_cast(scdr); static_cast(data); - scdr << data.id(); + scdr << data.id(); diff --git a/fastdds_python/test/types/test_modulesPubSubTypes.cxx b/fastdds_python/test/types/test_modulesPubSubTypes.cxx index e7c7bed6..297004fb 100644 --- a/fastdds_python/test/types/test_modulesPubSubTypes.cxx +++ b/fastdds_python/test/types/test_modulesPubSubTypes.cxx @@ -186,7 +186,8 @@ namespace eprosima { eprosima_test_StructType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || eprosima_test_StructType_max_key_cdr_typesize > 16) { @@ -368,7 +369,8 @@ namespace eprosima { eprosima_test_CompleteTestType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || eprosima_test_CompleteTestType_max_key_cdr_typesize > 16) { @@ -548,7 +550,8 @@ namespace eprosima { eprosima_test_KeyedCompleteTestType_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || eprosima_test_KeyedCompleteTestType_max_key_cdr_typesize > 16) { diff --git a/fastdds_python_examples/HelloWorldExample/HelloWorldCdrAux.ipp b/fastdds_python_examples/HelloWorldExample/HelloWorldCdrAux.ipp index 19316df7..30f135e3 100644 --- a/fastdds_python_examples/HelloWorldExample/HelloWorldCdrAux.ipp +++ b/fastdds_python_examples/HelloWorldExample/HelloWorldCdrAux.ipp @@ -113,8 +113,13 @@ void serialize_key( eprosima::fastcdr::Cdr& scdr, const HelloWorld& data) { + static_cast(scdr); static_cast(data); + scdr << data.index(); + + scdr << data.message(); + } diff --git a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx index f9a6f740..865410fd 100644 --- a/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx +++ b/fastdds_python_examples/HelloWorldExample/HelloWorldPubSubTypes.cxx @@ -184,7 +184,8 @@ bool HelloWorldPubSubType::compute_key( HelloWorld_max_key_cdr_typesize); // Object that serializes the data. - eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv1); + eprosima::fastcdr::Cdr ser(fastbuffer, eprosima::fastcdr::Cdr::BIG_ENDIANNESS, eprosima::fastcdr::CdrVersion::XCDRv2); + ser.set_encoding_flag(eprosima::fastcdr::EncodingAlgorithmFlag::PLAIN_CDR2); eprosima::fastcdr::serialize_key(ser, *p_type); if (force_md5 || HelloWorld_max_key_cdr_typesize > 16) { diff --git a/utils/scripts/update_generated_code_from_idl.sh b/utils/scripts/update_generated_code_from_idl.sh index e00a3bbe..e118a4c3 100755 --- a/utils/scripts/update_generated_code_from_idl.sh +++ b/utils/scripts/update_generated_code_from_idl.sh @@ -11,17 +11,17 @@ if [[ ! "$(pwd -P)" -ef "${current_dir}" ]]; then exit -1 fi -if [[ -z "$(which fastddsgen)" ]]; then - echo "Cannot find fastddsgen. Please, include it in PATH environment variable" - exit -1 -fi +# if [[ -z "$(which fastddsgen)" ]]; then +# echo "Cannot find fastddsgen. Please, include it in PATH environment variable" +# exit -1 +# fi ret_value=0 cd ./fastdds_python/test/types echo -e "Processing ${yellow}test_complete.idl test_modules.idl${textreset}" echo "Running: fastddsgen -replace -python test_complete.idl test_modules.idl" -fastddsgen -replace -python test_complete.idl test_modules.idl +/home/eprosima/fast-dds_ws_3/src/fastddsgen/scripts/fastddsgen -replace -python test_complete.idl test_modules.idl if [[ $? != 0 ]]; then ret_value=-1 fi @@ -32,7 +32,7 @@ if [[ $ret_value != -1 ]]; then echo -e "Processing ${yellow}HelloWorld.idl${textreset}" echo "Running: fastddsgen -replace -python HelloWorld.idl" - fastddsgen -replace -python HelloWorld.idl + /home/eprosima/fast-dds_ws_3/src/fastddsgen/scripts/fastddsgen -replace -python HelloWorld.idl fi if [[ $? != 0 ]]; then